Skip to content

Debug Failure. Expected [object Object] === [object Object]. Parameter symbol already has a cached type which differs from newly assigned type on TS 5.3 #57435

Closed
@marekdedic

Description

@marekdedic

🔎 Search Terms

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

🕗 Version & Regression Information

⏯ Playground Link

https://github.com/skaut/wordpress-version-checker/tree/typescript-chached-type-issue

💻 Code

See https://github.com/skaut/wordpress-version-checker/tree/typescript-chached-type-issue

Run npm ci && npm test

Sorry for not providing a playground link, but I could only replicate this with Jest involved

🙁 Actual behavior

 FAIL  __tests__/index.test.ts
  ● Test suite failed to run

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

    > 1 | import * as github from "@actions/github";
        | ^
      2 |
      3 | export async function testFn(): Promise<boolean> {
      4 |   const octokit = github.getOctokit("");

      at assignParameterType (node_modules/typescript/lib/typescript.js:75417:15)
      at assignContextualParameterTypes (node_modules/typescript/lib/typescript.js:75383:11)
      at contextuallyCheckFunctionExpressionOrObjectLiteralMethod (node_modules/typescript/lib/typescript.js:76107:15)
      at checkFunctionExpressionOrObjectLiteralMethod (node_modules/typescript/lib/typescript.js:76082:7)
      at checkExpressionWorker (node_modules/typescript/lib/typescript.js:77864:18)
      at checkExpression (node_modules/typescript/lib/typescript.js:77766:34)
      at maybeCheckExpression (node_modules/typescript/lib/typescript.js:76852:30)
      at BinaryExpressionStateMachine.onRight (node_modules/typescript/lib/typescript.js:76816:18)
      at Array.right (node_modules/typescript/lib/typescript.js:27972:36)
      at trampoline (node_modules/typescript/lib/typescript.js:27738:44)
      at node_modules/typescript/lib/typescript.js:76746:24
      at checkExpressionWorker (node_modules/typescript/lib/typescript.js:77889:18)
      at checkExpression (node_modules/typescript/lib/typescript.js:77766:34)
      at checkExpressionCached (node_modules/typescript/lib/typescript.js:77439:30)
      at checkVariableLikeDeclaration (node_modules/typescript/lib/typescript.js:80252:37)
      at checkVariableDeclaration (node_modules/typescript/lib/typescript.js:80348:7)
      at checkSourceElementWorker (node_modules/typescript/lib/typescript.js:83326:18)
      at checkSourceElement (node_modules/typescript/lib/typescript.js:83155:9)
      at forEach (node_modules/typescript/lib/typescript.js:55:24)
      at checkVariableDeclarationList (node_modules/typescript/lib/typescript.js:80360:7)
      at checkVariableStatement (node_modules/typescript/lib/typescript.js:80365:7)
      at checkSourceElementWorker (node_modules/typescript/lib/typescript.js:83295:18)
      at checkSourceElement (node_modules/typescript/lib/typescript.js:83155:9)
      at forEach (node_modules/typescript/lib/typescript.js:55:24)
      at checkSourceFileWorker (node_modules/typescript/lib/typescript.js:83544:9)
      at checkSourceFile (node_modules/typescript/lib/typescript.js:83511:7)
      at checkSourceFileWithEagerDiagnostics (node_modules/typescript/lib/typescript.js:83605:7)
      at getDiagnosticsWorker (node_modules/typescript/lib/typescript.js:83613:9)
      at getDiagnostics2 (node_modules/typescript/lib/typescript.js:83590:16)
      at Object.getEmitResolver (node_modules/typescript/lib/typescript.js:46737:7)
      at emitWorker (node_modules/typescript/lib/typescript.js:120185:45)
      at node_modules/typescript/lib/typescript.js:120172:53
      at runWithCancellationToken (node_modules/typescript/lib/typescript.js:120261:16)
      at Object.emit (node_modules/typescript/lib/typescript.js:120172:22)
      at getFileEmitOutput (node_modules/typescript/lib/typescript.js:122554:50)
      at Object.getEmitOutput (node_modules/typescript/lib/typescript.js:143188:14)
      at TsCompiler.getCompiledOutput (node_modules/ts-jest/dist/legacy/compiler/ts-compiler.js:142:48)
      at TsJestCompiler.getCompiledOutput (node_modules/ts-jest/dist/legacy/compiler/ts-jest-compiler.js:14:39)
      at TsJestTransformer.exports.TsJestTransformer.TsJestTransformer.processWithTs (node_modules/ts-jest/dist/legacy/ts-jest-transformer.js:259:37)
      at TsJestTransformer.exports.TsJestTransformer.TsJestTransformer.process (node_modules/ts-jest/dist/legacy/ts-jest-transformer.js:188:24)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:545:31)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:674:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:726:19)
      at Object.<anonymous> (node_modules/undici/lib/fetch/util.js:3:85)
      at Object.<anonymous> (node_modules/undici/lib/fetch/headers.js:12:5)
      at Object.<anonymous> (node_modules/undici/index.js:118:28)
      at Object.<anonymous> (node_modules/@actions/http-client/lib/index.js:41:18)
      at Object.<anonymous> (node_modules/@actions/github/lib/internal/utils.js:36:33)
      at Object.<anonymous> (node_modules/@actions/github/lib/utils.js:28:28)
      at Object.<anonymous> (node_modules/@actions/github/lib/github.js:28:17)
      at Object.<anonymous> (src/index.ts:1:1)
      at Object.<anonymous> (__tests__/index.test.ts:3:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.149 s
Ran all test suites.

🙂 Expected behavior

No TS error - the test should run

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad outputFix 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