Skip to content

Debug Failure. Parameter symbol already has a cached type which differs from newly assigned type. #49383

Closed
@denis-sokolov

Description

@denis-sokolov

Bug Report

🔎 Search Terms

Error: Debug Failure. Expected [object Object] === [object Object]. Parameter symbol already has a cached type which differs from newly assigned type

🕗 Version & Regression Information

  • This is a crash
  • This changed between versions 4.6.4 and 4.7.2
  • This is still happening with the currently latest 4.8.0-dev.20220603

⏯ Playground Link

Does not reproduce in the playground, only reproduces in CLI. To reproduce, run tsc code.ts with the code below.

💻 Code

function wrap<Args extends unknown[]>(_: (...args: Args) => void) {}
wrap(({ cancelable } = {}) => {});

🙁 Actual behavior

Error: Debug Failure. Expected [object Object] === [object Object]. Parameter symbol already has a cached type which differs from newly assigned type
    at assignParameterType (node_modules/typescript/lib/tsc.js:64861:26)
    at assignContextualParameterTypes (node_modules/typescript/lib/tsc.js:64826:21)
    at contextuallyCheckFunctionExpressionOrObjectLiteralMethod (node_modules/typescript/lib/tsc.js:65228:29)
    at checkFunctionExpressionOrObjectLiteralMethod (node_modules/typescript/lib/tsc.js:65207:13)
    at checkExpressionWorker (node_modules/typescript/lib/tsc.js:66804:28)
    at checkExpression (node_modules/typescript/lib/tsc.js:66706:38)
    at checkExpressionWithContextualType (node_modules/typescript/lib/tsc.js:66395:28)
    at inferTypeArguments (node_modules/typescript/lib/tsc.js:62905:39)
    at chooseOverload (node_modules/typescript/lib/tsc.js:63565:53)
    at resolveCall (node_modules/typescript/lib/tsc.js:63402:26)

🙂 Expected behavior

No crash.

(Ideally an error about an implicit any)

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