Skip to content

Debug Failure. No error for last overload signature #48636

Closed
@pfgithub

Description

@pfgithub

Bug Report

🔎 Search Terms

"Debug Failure. No error for last overload signature"

Also, for anyone in the future finding a minimal reproduction for an error like this: edit node_modules/typescript/tsc.js in order to find out which line is causing the crash

- ts.Debug.fail("No error for last overload signature");
+ ts.Debug.fail("No error for last overload signature. Call:\n" + ts.getTextOfNode(node));

🕗 Version & Regression Information

  • This is a crash

⏯ Playground Link

Workbench link with relevant code

💻 Code

type DeepReadonly<T> = 0 extends 1 & T ? T : {
    readonly [K in keyof T]: DeepReadonly<T[K]>;
};
declare function reconcile<T extends U, U>(value: T): (state: U) => T;

type StoreSetter<T> = ((prevState: DeepReadonly<T>) => DeepReadonly<T>);

type SetStoreFunction<T> = (setter: StoreSetter<T>) => void;

export function typescriptCrash<T>(
    value: DeepReadonly<T>,
    setValue: SetStoreFunction<T | null>,
) {
    setValue(reconcile(value));
}

🙁 Actual behavior

Typescript crashed.

Debug Failure. No error for last overload signature

fail@https://typescript.azureedge.net/cdn/4.7.0-dev.20220408/monaco/dev/vs/language/typescript/tsWorker.js:2468:17
resolveCall@https://typescript.azureedge.net/cdn/4.7.0-dev.20220408/monaco/dev/vs/language/typescript/tsWorker.js:62458:27
resolveCallExpression@https://typescript.azureedge.net/cdn/4.7.0-dev.20220408/monaco/dev/vs/language/typescript/tsWorker.js:62780:16
resolveSignature@https://typescript.azureedge.net/cdn/4.7.0-dev.20220408/monaco/dev/vs/language/typescript/tsWorker.js:63097:20
…

🙂 Expected behavior

Typescript should not have crashed. Also, I think the code should compile with no errors, but I'm not sure.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions