feat: add proper JSDoc annotations to all public api and generate TS …#33
feat: add proper JSDoc annotations to all public api and generate TS …#33developit merged 4 commits intodevelopit:masterfrom
Conversation
| * @property {Options} config the request configuration | ||
| * @property {any} data the decoded response body | ||
| * @property {T} data the decoded response body | ||
| * @property {Headers} headers |
There was a problem hiding this comment.
I've added all fields that are assigned to the response to properly match implementation (dunno if it's on purpose, or we wanna strictly "match" axios response - in that case those need to be removed + omit those within implementation)
| * @public | ||
| * @type {AbortController} | ||
| */ | ||
| redaxios.CancelToken = /** @type {any} */ (self).AbortController || Object; |
There was a problem hiding this comment.
this is TypeScript dom types issue as AbortController is not defined on Window interface
|
|
||
| /* Strict Type-Checking Options */ | ||
| "strict": true, /* Enable all strict type-checking options. */ | ||
| "suppressImplicitAnyIndexErrors": true, |
There was a problem hiding this comment.
easy up strict checks
| // "strictFunctionTypes": true, /* Enable strict checking of function types. */ | ||
| // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ | ||
| // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ | ||
| "noImplicitThis": false, /* Raise error on 'this' expressions with an implied 'any' type. */ |
There was a problem hiding this comment.
easy up strict checks
| "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ | ||
| }, | ||
| "include": [ | ||
| "src" |
There was a problem hiding this comment.
enable on src/ only (excluding tests)
| "karmatic": "^1.4.0", | ||
| "microbundle": "^0.11.0", | ||
| "sinon": "^8.0.4", | ||
| "typescript": "3.9.3", |
There was a problem hiding this comment.
this doesn't have to be as direct dep, microbundle will handle that in future
marvinhagemeister
left a comment
There was a problem hiding this comment.
This is fantastic! Love it 🙌
|
|
||
| /** */ | ||
| export default (function create(defaults) { | ||
| export default (function create(/** @type {Options} */ defaults) { |
There was a problem hiding this comment.
If it's easier to break the export and declaration out, I think microbundle+terser will collapse them all the same:
/** @param {Options} defaults */
function create() {
// ...
}
export default create();|
"Compressed Size / build (pull_request)" fails, why ? Looking at "details" didn't helped me understand the issue here, this MR increased the pkg size too much ? |
|
The relevant error message is: src/index.js(210,25): error TS2339: Property 'withCredentials' does not exist on type 'Options'.Looks like there is a type error in the changes |
Closes #22
NOTES:
tscinvoke can be removed when Add --generate-types option microbundle#589 lands to master