You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like one of tsd@0.11.0's dependencies was previously satisfying a typescript dependency required by @typescript-eslint in xo but is no longer satisfied:
Cannot find module 'typescript'
Error: Failed to load parser '/home/runner/work/p-all/p-all/node_modules/@typescript-eslint/parser/dist/parser.js' declared in 'BaseConfig': Cannot find module 'typescript'
Require stack:
- /home/runner/work/p-all/p-all/node_modules/@typescript-eslint/typescript-estree/dist/parser.js
- /home/runner/work/p-all/p-all/node_modules/@typescript-eslint/parser/dist/parser.js
- /home/runner/work/p-all/p-all/node_modules/eslint/lib/cli-engine/config-array-factory.js
- /home/runner/work/p-all/p-all/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js
- /home/runner/work/p-all/p-all/node_modules/eslint/lib/cli-engine/cli-engine.js
- /home/runner/work/p-all/p-all/node_modules/eslint/lib/cli-engine/index.js
- /home/runner/work/p-all/p-all/node_modules/eslint/lib/api.js
- /home/runner/work/p-all/p-all/node_modules/xo/index.js
- /home/runner/work/p-all/p-all/node_modules/xo/cli-main.js
- /home/runner/work/p-all/p-all/node_modules/xo/cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/runner/work/p-all/p-all/node_modules/@typescript-eslint/typescript-estree/dist/parser.js:20:25)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19)
npm ERR! Test failed. See above for more details.
Installing the latest typescript as a devDependency yields:
Parsing error: Cannot read property map of undefined
$ npm test
> p-all@3.0.0 test /Users/osame/Documents/public-github/sindresorhus/p-all
> xo && ava && tsd
index.test-d.ts
✖ Parsing error: Cannot read property map of undefined
index.d.ts
✖ Parsing error: Cannot read property map of undefined
2 errors
$ npm test
> p-all@3.0.0 test /Users/osame/Documents/public-github/sindresorhus/p-all
> xo && ava && tsd
index.test-d.ts:2:15
✖ 2:15 A require() style import is forbidden. @typescript-eslint/no-require-imports
✖ 16:7 Unsafe assignment of an any value. @typescript-eslint/no-unsafe-assignment
✖ 18:20 Unsafe member access [0] on an any value. @typescript-eslint/no-unsafe-member-access
✖ 19:20 Unsafe member access [1] on an any value. @typescript-eslint/no-unsafe-member-access
✖ 20:18 Unsafe member access [2] on an any value. @typescript-eslint/no-unsafe-member-access
✖ 21:20 Unsafe member access [3] on an any value. @typescript-eslint/no-unsafe-member-access
index.d.ts:34:15
⚠ 10:1 Unexpected todo comment: TODO: Refactor the whole definition back.... no-warning-comments
✖ 34:15 pAll is already defined. @typescript-eslint/no-redeclare
✖ 37:15 There should be no space after {. @typescript-eslint/object-curly-spacing
✖ 37:110 There should be no space before }. @typescript-eslint/object-curly-spacing
index.js:1:1
✖ 1:1 Do not use "use strict" directive. unicorn/prefer-module
✖ 2:14 Do not use "require". unicorn/prefer-module
✖ 4:1 Do not use "module". unicorn/prefer-module
1 warning
12 errors
I would have to add a tsconfig.json to eliminate the @typescript-eslint/no-unsafe-member-access errors. I can copy the default config that tsd uses, but I know you usually don't have these in your repo. I can disable the prefer-module rules for now.
How would you like me to move forward?
sindresorhus
changed the title
refactor(type): use variadic-tuple to remove overloads
Improve TypeScript types by using variadic tuple instead of overloads
May 31, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Changes
Use variadic tuple types to support all input lengths.
This is a breaking change in type:
Before:
With variadic tuple:
Tests are passing
References