-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add .d.ts files generation on cozy-stack-client #1234
base: master
Are you sure you want to change the base?
Conversation
@@ -516,7 +516,7 @@ class OAuthClient extends CozyStackClient { | |||
/** | |||
* Updates the client's stored token | |||
* | |||
* @param {string} token = null The new token to use — can be a string, a json object or an AccessToken instance. | |||
* @param {AccessToken|string} token = null The new token to use — can be a string, a json object or an AccessToken instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can also be null
@@ -21,6 +21,10 @@ export function isSecureProtocol(urlArg) { | |||
export function getBrowserCozyURL() { | |||
try { | |||
const root = document.querySelector('[role=application]') | |||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ts-ignore is only for this block of code, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes @ts-ignore
is for the following line. For the entire document we would use @ts-nocheck
@@ -15,6 +15,7 @@ class ShortcutsCollection extends DocumentCollection { | |||
* @param {string} attributes.name Filename | |||
* @param {string} attributes.url Shortcut's URL | |||
* @param {string} attributes.dir_id dir_id where to create the shortcut | |||
* @param {string} attributes.type TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should only be empty or io.cozy.files.shortcuts
@@ -16,7 +16,10 @@ const headersFromString = headerString => { | |||
* @private | |||
* @param {string} fullpath - Route path | |||
* @param {object} options - Fetch options | |||
* @param {Function} options.onUploadProgress - Callback to receive upload progress events | |||
* @param {(this: XMLHttpRequestUpload, ev: ProgressEvent<XMLHttpRequestEventTarget>) => any} options.onUploadProgress - Callback to receive upload progress events | |||
* @param {string} options.method - TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if TS comes with built-in type for this, but can be one of those https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
Nice! (cc @acezard since we talk about that recently ;)) |
9e1a551
to
928529d
Compare
f72d1cf
to
eb46bf2
Compare
I can't approve my own PR, but latest changes looks good to me 👍 |
With previous order `this.token` would be inferred as `string|AppToken|AccessToken` instead of `AppToken|AccessToken`
7f79c72
to
843fce9
Compare
These types are needed in the native app. For now I did not find how to make JSDoc understand that CozyStackClient will inherit OAuthClient methods, that's the only thing not working for 100% flagship app compat
On our Flagship mobile app I need type declaration for
client.getStackClient()
so I'm trying to add.d.ts
files generation on cozy-stack-client like it is already set for cozy-clientThere are a lot of TS errors, so this PR may take a bit of time. It is draft for now, so you can help if you want to.
For now:
chore
commits are only JSDoc related ones, so they should not impact the lib's behaviourfeat
commits are modifying the code, so the behaviour may be impacted, we should keep our attention on themfix
commits are for fixing bugs highlighted by TS-check. My understanding is that current code should not work by construction