TypeScript: 3.6 regression: `Error: Debug Failure. No error for last overload signature`

TypeScript Version: 3.6.2

Search Terms: debug failure overload signature

After upgrading our large app from TS 3.5.2 to to TS 3.6.2, we get the following error when running tsc:

$ tsc  --project tsconfig.json
/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:75634
                throw e;
                ^

Error: Debug Failure. No error for last overload signature
    at resolveCall (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:43576:38)
    at resolveJsxOpeningLikeElement (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:44148:20)
    at resolveSignature (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:44169:28)
    at getResolvedSignature (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:44180:26)
    at checkJsxOpeningLikeElementOrOpeningFragment (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:42398:27)
    at checkJsxSelfClosingElementDeferred (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:42042:13)
    at checkDeferredNode (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:50211:21)
    at Map.forEach (<anonymous>)
    at checkDeferredNodes (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:50189:37)
    at checkSourceFileWorker (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsc.js:50249:17)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (14 by maintainers)

Commits related to this issue

Most upvoted comments

  1. In tsc.js, search for
                            Debug.fail("No error for last overload signature");

and change to

                            var s = "\nCall:"  + getTextOfNode(node) + "\nDeclarations:\t" + candidatesForArgumentError.map(c => c.declaration ? getTextOfNode(c.declaration) : "no declaration found").join(",");
                            Debug.fail("No error for last overload signature" + s);

We should consider making Debug.fail take a node or nodes to print.

would be handy to have this handy workaround released to get some useful insight when this kind of error eventually emerge !

  1. In tsc.js, search for
                            Debug.fail("No error for last overload signature");

and change to

                            var s = "\nCall:"  + getTextOfNode(node) + "\nDeclarations:\t" + candidatesForArgumentError.map(c => c.declaration ? getTextOfNode(c.declaration) : "no declaration found").join(",");
                            Debug.fail("No error for last overload signature" + s);

We should consider making Debug.fail take a node or nodes to print.

Standalone repro:

interface F<P> {
    (props: P & { children?: boolean }): void;
    propTypes: { [K in keyof P]: null extends P ? K : K };
}
declare function g(C: F<unknown>): string;
export function wu<CP extends { o: object }>(CC: F<CP>) {
    class WU {
        m() {
            g(CC)
            return <CC {...(null as CP)} />;
        }
    }
}

This is, admittedly, super weird.

I just had this happen in 5.2.2.
Going to try getting more info.

It doesn’t show errors in VSCode though. only when I run tsc --noEmit.

The line that is blowing up is using a type from Prisma as well as a proxied version of the PrismaClient, so getting a minimal repo will be tough

I ran into this with 3.8. Should I try to make a reproduction repo?

For my own ref: this happened at 27541dbd0

@sandersn Works for me now in typescript@3.6.3-insiders.20190909. Thanks!

I added that assert in 3.6 to catch an incorrect state during error reporting. So, uh, looks like you caught it!

This needs a smaller repro before I can continue. When I get to my desk I’ll come up with an assert message that dumps the current file or the text of the node. That way you can modify tsc.js to pinpoint the call.