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
Run tsc --traceResolution and paste its output here
File '/Users/damians/Desktop/ts-repro/services/api/src/package.json' does not exist.
Found 'package.json' at '/Users/damians/Desktop/ts-repro/services/api/package.json'.
======== Resolving module 'ioredis' from '/Users/damians/Desktop/ts-repro/services/api/src/index.ts'. ========
Explicitly specified module resolution kind: 'NodeNext'.
Resolving in ESM mode with conditions 'import', 'types', 'node'.
'baseUrl' option is set to '/Users/damians/Desktop/ts-repro', using this value to resolve non-relative module name 'ioredis'.
Resolving module name 'ioredis' relative to base url '/Users/damians/Desktop/ts-repro' - '/Users/damians/Desktop/ts-repro/ioredis'.
Loading module as file / folder, candidate module location '/Users/damians/Desktop/ts-repro/ioredis', target file types: TypeScript, JavaScript, Declaration, JSON.
Directory '/Users/damians/Desktop/ts-repro/ioredis' does not exist, skipping all lookups in it.
File '/Users/damians/Desktop/ts-repro/services/api/src/package.json' does not exist according to earlier cached lookups.
File '/Users/damians/Desktop/ts-repro/services/api/package.json' exists according to earlier cached lookups.
Loading module 'ioredis' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON.
Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration.
Directory '/Users/damians/Desktop/ts-repro/services/api/src/node_modules' does not exist, skipping all lookups in it.
Found 'package.json' at '/Users/damians/Desktop/ts-repro/services/api/node_modules/ioredis/package.json'.
'package.json' does not have a 'typesVersions' field.
'package.json' does not have a 'typings' field.
'package.json' has 'types' field './built/index.d.ts' that references '/Users/damians/Desktop/ts-repro/services/api/node_modules/ioredis/built/index.d.ts'.
File '/Users/damians/Desktop/ts-repro/services/api/node_modules/ioredis/built/index.d.ts' exists - use it as a name resolution result.
'package.json' does not have a 'peerDependencies' field.
Resolving real path for '/Users/damians/Desktop/ts-repro/services/api/node_modules/ioredis/built/index.d.ts', result '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/index.d.ts'.
======== Module name 'ioredis' was successfully resolved to '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/index.d.ts' with Package ID 'ioredis/built/[email protected]'. ========
File '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/package.json' does not exist.
Found 'package.json' at '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/package.json'.
======== Resolving module './Redis' from '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/index.d.ts'. ========
Explicitly specified module resolution kind: 'NodeNext'.
Resolving in CJS mode with conditions 'require', 'types', 'node'.
Loading module as file / folder, candidate module location '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/Redis', target file types: TypeScript, JavaScript, Declaration, JSON.
File '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/Redis.ts' does not exist.
File '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/Redis.tsx' does not exist.
File '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/Redis.d.ts' exists - use it as a name resolution result.
File '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/package.json' exists according to earlier cached lookups.
'package.json' does not have a 'peerDependencies' field.
....OMISSIS....
======== Module name '@typescript/lib-webworker' was not resolved. ========
File '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File '/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/typescript/package.json' exists according to earlier cached lookups.
services/api/src/index.ts:2:19 - error TS2351: This expression is not constructable.
Type 'typeof import("/Users/damians/Desktop/ts-repro/node_modules/.pnpm/[email protected]/node_modules/ioredis/built/index")' has no construct signatures.
2 const redis = new Redis();
~~~~~
Found 1 error in services/api/src/index.ts:2
ELIFECYCLE Command failed with exit code 1.
Paste the package.json of the importing module, if it exists
Demo Repo
https://github.com/damianobarbati/ts-repro
Which of the following problems are you reporting?
The module specifier resolves to the right file, but something about the types are wrong
Demonstrate the defect described above with a code sample.
To reproduce:
Here the line where this can be seen:
https://github.com/damianobarbati/ts-repro/blob/typescript-constructable-issue/services/api/src/index.ts#L2
Run
tsc --showConfig
and paste its output hereRun
tsc --traceResolution
and paste its output herePaste the
package.json
of the importing module, if it existsPaste the
package.json
of the target module, if it existsAny other comments can go here
I'm using NodeNext to leverage the new node flag
--transform-types
.The text was updated successfully, but these errors were encountered: