-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
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
Comments
Minimal repro case with JS file (TS playground): 'use strict';
/** @type {globalThis['structuredClone']} */
const structuredClone =
globalThis.structuredClone ??
function structuredClone (value, options = undefined) {
if (arguments.length === 0) {
throw new TypeError('missing argument')
}
return value;
} |
The problem is related to the synthetic rest parameter that is added by There is a comment there that this deferred type is meant to be overridable by contextual typing if it's not locked by So likely that comment doesn't hold true at all. It's likely that this type is requested at all times and it's never overridden by the contextual type in practice. I think that There is an extra potential issue here though. As I mentioned, that code comment implies that the contextual type might not override the type of this synthetic symbol if its type gets requested before it gets to that. That implies that it just shouldn't throw at all in such a situation as it's implied that it's possible. Yet it is a hard - unconditional - crash if that ever happens. An extra thing about this specific case is that maybe Either way, I'll give this more thought and put up a PR with the fix some time later. |
Seeing the related activity in the PRs, I just want to note that the issue persists for me even with TS 5.4.4. Don't know if that's any help... Thanks! |
The PR that fixed it (#57580) is not part of the 5.4 release - it has landed on |
The issue is fixed on 5.5, thanks! |
🔎 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
🙂 Expected behavior
No TS error - the test should run
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: