-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
π Search Terms
Cannot read properties of undefined, tsc crash
π Version & Regression Information
First noticed on 5.0.0-dev.20221118 nightly build, persists on 5.0.0-dev.20221122
β― Playground Link
π» Code
// main.ts
import {Foo} from './x';
function bar<T>(element: Foo) {
return 1;
}
bar(1 as Foo<number>);
// x.ts
export type Foo<T = string> = {};
π Actual behavior
A crash:
/usr/local/lib/node_modules/typescript/lib/tsc.js:98593
throw e;
^
TypeError: Cannot read properties of undefined (reading 'length')
at inferFromTypeArguments (/usr/local/lib/node_modules/typescript/lib/tsc.js:55506:54)
at inferFromTypes (/usr/local/lib/node_modules/typescript/lib/tsc.js:55314:11)
at inferTypes (/usr/local/lib/node_modules/typescript/lib/tsc.js:55300:5)
at inferTypeArguments (/usr/local/lib/node_modules/typescript/lib/tsc.js:61051:11)
at chooseOverload (/usr/local/lib/node_modules/typescript/lib/tsc.js:61672:33)
at resolveCall (/usr/local/lib/node_modules/typescript/lib/tsc.js:61539:16)
at resolveCallExpression (/usr/local/lib/node_modules/typescript/lib/tsc.js:61870:12)
at resolveSignature (/usr/local/lib/node_modules/typescript/lib/tsc.js:62215:16)
at getResolvedSignature (/usr/local/lib/node_modules/typescript/lib/tsc.js:62235:20)
at checkCallExpression (/usr/local/lib/node_modules/typescript/lib/tsc.js:62340:23)
π Expected behavior
Success or compilation errors.
h-joo, nicolas377 and ThiagodePaulaSouza
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFix AvailableA PR has been opened for this issueA PR has been opened for this issue