Skip to content

Commit

Permalink
fix: swap @yields for @returns (#178)
Browse files Browse the repository at this point in the history
Motivation:
* Fix ipfs/js-ipfs#4080
* tl;dr
  * fix `import globSourceImport from 'ipfs-utils/src/files/glob-source.js'` from typescript
  * fix importing ipfs-core from typescript

Context:
* microsoft/TypeScript#23857

Strategy
* Use jsdoc `@return` instead of `@yields` because tsc doesn't understand that `@yields` implies a `@return` type

Test Case
* gobengo/ipfs-core-esm-test#3
* I tested locally with `npm link` and this seemed to fix it
  • Loading branch information
gobengo committed Apr 19, 2022
1 parent b319e67 commit 13e2c9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/files/glob-source.js
Expand Up @@ -18,7 +18,12 @@ const errCode = require('err-code')
* @param {boolean} [options.preserveMtime] - preserve mtime
* @param {number} [options.mode] - mode to use - if preserveMode is true this will be ignored
* @param {import('ipfs-unixfs').MtimeLike} [options.mtime] - mtime to use - if preserveMtime is true this will be ignored
* @yields {Object} File objects in the form `{ path: String, content: AsyncIterator<Buffer> }`
* @returns {AsyncGenerator<{
* path: string;
* content: AsyncIterable<Buffer> | undefined;
* mode: number | undefined;
* mtime: import("ipfs-unixfs/types/src/types").MtimeLike | undefined;
* }, void, unknown>} File objects that match glob
*/
module.exports = async function * globSource (cwd, pattern, options) {
options = options || {}
Expand Down

0 comments on commit 13e2c9b

Please sign in to comment.