Skip to content

Commit 33f1bc2

Browse files
committed
fix(kitsu): correct jsdoc type definitions of return types
1 parent a973b00 commit 33f1bc2

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

packages/kitsu/src/index.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import pluralise from 'pluralize'
66
* Creates a new `kitsu` instance
77
*
88
* @param {Object} [options] Options
9-
* @param {string} [options.baseURL=https://kitsu.app/api/edge] Set the API endpoint
9+
* @param {string} [options.baseURL='https://kitsu.app/api/edge'] Set the API endpoint
1010
* @param {Object} [options.headers] Additional headers to send with the requests
1111
* @param {'traditional'|'modern'|Function} [options.query=traditional] Query serializer function to use. This will impact the way keys are serialized when passing arrays as query parameters. 'modern' is recommended for new projects.
1212
* @param {boolean} [options.camelCaseTypes=true] If enabled, `type` will be converted to camelCase from kebab-casae or snake_case
@@ -33,7 +33,7 @@ export default class Kitsu {
3333
const traditional = typeof options.query === 'string' ? options.query === 'traditional' : true
3434
this.query = typeof options.query === 'function'
3535
? options.query
36-
: obj => query(obj, null, traditional)
36+
: obj => query(obj, undefined, traditional)
3737

3838
if (options.camelCaseTypes === false) this.camel = s => s
3939
else this.camel = camel
@@ -140,7 +140,7 @@ export default class Kitsu {
140140
* @param {string} [config.params.page.before] Get the previous page of resources (Cursor-based) - **Note:** Not Supported on kitsu.app
141141
* @param {string} [config.params.page.after] Get the next page of resources (Cursor-based) - **Note:** Not Supported on kitsu.app
142142
* @param {Object} [config.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
143-
* @returns {Object} JSON-parsed response
143+
* @returns {Promise<Object>} JSON-parsed response
144144
* @example <caption>Getting a resource with JSON:API parameters</caption>
145145
* api.get('users', {
146146
* params: {
@@ -183,7 +183,7 @@ export default class Kitsu {
183183
* }
184184
* }
185185
* }
186-
* }
186+
* })
187187
* @example <caption>Handling errors (async/await)</caption>
188188
* try {
189189
* const { data } = await api.get('anime')
@@ -262,7 +262,7 @@ export default class Kitsu {
262262
* @param {Object} [config.params] JSON:API request queries. See [#get](#get) for documentation
263263
* @param {Object} [config.headers] Additional headers to send with the request
264264
* @param {Object} [config.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
265-
* @returns {Object|Object[]} JSON-parsed response
265+
* @returns {Promise<Object|Object[]>} JSON-parsed response
266266
* @example <caption>Update a resource</caption>
267267
* api.update('posts', {
268268
* id: '1',
@@ -332,7 +332,7 @@ export default class Kitsu {
332332
* @param {Object} [config.params] JSON:API request queries. See [#get](#get) for documentation
333333
* @param {Object} [config.headers] Additional headers to send with the request
334334
* @param {Object} [config.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
335-
* @returns {Object|Object[]} JSON-parsed response
335+
* @returns {Promise<Object|Object[]>} JSON-parsed response
336336
* @example <caption>Create a post on a user's profile feed</caption>
337337
* api.create('posts', {
338338
* content: 'Hello World',
@@ -399,7 +399,7 @@ export default class Kitsu {
399399
* @param {Object} [config.params] JSON:API request queries. See [#get](#get) for documentation
400400
* @param {Object} [config.headers] Additional headers to send with the request
401401
* @param {Object} [config.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
402-
* @returns {Object|Object[]} JSON-parsed response
402+
* @returns {Promise<Object|Object[]>} JSON-parsed response
403403
* @example <caption>Remove one or more relationships from a resource</caption>
404404
* api.delete('posts/1/relationships/uploads', [456, 789])
405405
* @example <caption>Remove a single resource</caption>
@@ -459,7 +459,7 @@ export default class Kitsu {
459459
* @param {Object} [config.params] JSON:API request queries. See [#get](#get) for documentation
460460
* @param {Object} [config.headers] Additional headers to send with the request
461461
* @param {Object} [config.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
462-
* @returns {Object} JSON-parsed response
462+
* @returns {Promise<Object>} JSON-parsed response
463463
* @example <caption>Get the authenticated user's resource</caption>
464464
* api.self()
465465
* @example <caption>Using JSON:API parameters</caption>
@@ -488,15 +488,15 @@ export default class Kitsu {
488488
* **Note** Planned changes to the `get`, `patch`, `post` and `delete` methods in a future major release may make this method redundent. See https://github.com/wopian/kitsu/issues/415 for details.
489489
*
490490
* @memberof Kitsu
491-
* @param {Object} [config] Request configuration
491+
* @param {Object} config Request configuration
492492
* @param {string} config.url The URL path of the resource
493493
* @param {string} config.type The resource type
494494
* @param {Object|Object[]} [config.body] Data to send in the request
495495
* @param {string} [config.method] Request method - `GET`, `PATCH`, `POST` or `DELETE` (defaults to `GET`, case-insensitive)
496496
* @param {Object} [config.params] JSON:API request queries. See [#get](#get) for documentation
497497
* @param {Object} [config.headers] Additional headers to send with the request
498498
* @param {Object} [config.axiosOptions] Additional options for the axios instance (see [axios/axios#request-config](https://github.com/axios/axios#request-config) for details)
499-
* @returns {Object} JSON-parsed response
499+
* @returns {Promise<Object>} JSON-parsed response
500500
* @example <caption>Raw GET request</caption>
501501
* api.request({
502502
* url: 'anime/1/mappings',

0 commit comments

Comments
 (0)