Skip to content

Debug Failure. No error for last overload signature #60229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thomasballinger opened this issue Oct 15, 2024 · 7 comments
Open

Debug Failure. No error for last overload signature #60229

thomasballinger opened this issue Oct 15, 2024 · 7 comments
Assignees
Labels
Bug A bug in TypeScript

Comments

@thomasballinger
Copy link

thomasballinger commented Oct 15, 2024

🔎 Search Terms

Debug Failure. No error for last overload signature

possibly related to

🕗 Version & Regression Information

  • This is the behavior in every version I tried, from 4.5.5 on through 5.7.0-dev.20241014. In 4.4 there's a different error, RangeError: Maximum call stack size exceeded.

⏯ Playground Link

Playground link

💻 Code

// First copy of a library
type ComponentDefinitionExports<T> =
  T extends ComponentDefinition<infer Exports> ? Exports : never;

class InstalledComponent<Definition extends ComponentDefinition<any>> {
  get exports(): ComponentDefinitionExports<Definition> {
    return null as any;
  }
}

type ComponentDefinition<_Exports> = {
  use<Definition extends ComponentDefinition<any>>(
    definition: Definition
  ): InstalledComponent<Definition>;
};

function defineComponent(): ComponentDefinition<any> {
  return null as any as ComponentDefinition<any>;
}

const aggregate = defineComponent();

// Imagine another copy of the library

type ComponentDefinitionExports2<T> =
  T extends ComponentDefinition2<infer Exports> ? Exports : never;

class InstalledComponent2<Definition extends ComponentDefinition2<any>> {
  get exports(): ComponentDefinitionExports2<Definition> {
    return null as any;
  }
}

type ComponentDefinition2<_Exports> = {
  use<Definition extends ComponentDefinition2<any>>(
    definition: Definition
  ): InstalledComponent2<Definition>;
};

export type AppDefinition2 = {
  use<Definition extends ComponentDefinition2<any>>(
    definition: Definition
  ): InstalledComponent2<Definition>;
};

export function defineApp2(): AppDefinition2 {
  return null as any;
}

const app = defineApp2();
app.use(aggregate);

🙁 Actual behavior

tsc exits with error code 1 and write to stderr Debug Failure. No error for last overload signature

/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:113984
      throw e;
      ^

Error: Debug Failure. No error for last overload signature
    at resolveCall (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:69834:19)
    at resolveCallExpression (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:70216:12)
    at resolveSignature (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:70599:16)
    at getResolvedSignature (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:70619:20)
    at checkCallExpression (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:70728:23)
    at checkExpressionWorker (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:73819:16)
    at checkExpression (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:73729:32)
    at checkExpressionStatement (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:76310:5)
    at checkSourceElementWorker (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:79237:16)
    at checkSourceElement (/Users/tomb/aggregate/node_modules/typescript/lib/tsc.js:79097:7)

In the playground,

Uncaught (in promise) Error: Debug Failure. No error for last overload signature
    at wR (tsWorker.js:341:318135)
    ...

🙂 Expected behavior

I'm not sure. I'd like this to pass typechecking.

Additional information about the issue

I tried to minimize this but I imagine this is not the minimal repro. Please give this a better title :)

@MartinJohns
Copy link
Contributor

MartinJohns commented Oct 15, 2024

Duplicate of #60202.

@thomasballinger
Copy link
Author

I don't think this is a dup of #60202, that one does not repro in 5.5.4 and below but this one does.

@Andarist
Copy link
Contributor

I can also confirm that my PR doesn't fix this issue

@JesusTheHun
Copy link

JesusTheHun commented Nov 12, 2024

I'm facing the same error but with a slightly different stack trace.
I don't know if it's a dup, let me know if I should open a new issue. I've reproduced with 5.4.5 and 5.6.3

> @cbjsdev/[email protected] build /private/tmp/cbjs/packages/cbjs
> tsc -p tsconfig.build.json
/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:118651
      throw e;
      ^
Error: Debug Failure. No error for last overload signature
    at resolveCall (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:72167:19)
    at resolveCallExpression (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:72549:12)
    at resolveSignature (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:72949:16)
    at getResolvedSignature (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:72971:18)
    at checkCallExpression (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:73083:23)
    at checkExpressionWorker (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:76305:16)
    at checkExpression (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:76216:32)
    at checkExpressionCached (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:75889:28)
    at checkDeclarationInitializer (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:75917:9)
    at getTypeForVariableLikeDeclaration (/private/tmp/cbjs/node_modules/.pnpm/[email protected]/node_modules/typescript/lib/tsc.js:52446:66)

@Andarist
Copy link
Contributor

@JesusTheHun could u try with [email protected]? Isolating the repro case would also be appreciated. A stack trace alone doesn't quite help fixing an issue like this.

@JesusTheHun
Copy link

JesusTheHun commented Nov 12, 2024

@Andarist the issue is still present with 5.8.0-dev.20241112.
I can provide a repro, but I haven't narrowed it down yet.

@JesusTheHun
Copy link

@Andarist

Checkout : https://github.com/cbjs-dev/cbjs/tree/typescript-issue
Search for the text ISSUE 60229, you will end up in the file packages/cbjs/src/services/kv/mutateIn/ChainableMutateIn.ts.

If you swap Path for Extract<NoInfer<Path>, MutateInArrayInsertPath<Def>>, the issue is resolved.

I understand this is not a minimal reproduction, but hopefully it will help you narrow the field of research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

6 participants