You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objects with the same type from different files have different behavior.
It happens when the type extends a type that is not Empty.
🔎 Search Terms
Actually, the problem is so weird that as a non-native English speaker, I don't know what keyword I should use to search.
I can only find something like duplicated type declarations from multiple files etc...
🕗 Version & Regression Information
typescript: 4.4.4
tslib: 2.3.1
I just find that inconsistent behavior.
Add: Just checked all my recently used versions, this happens from(but not starts at, because I haven't used this code at versions that are lower than 4.1.3) [email protected] to [email protected].
⏯ Playground Link
It only happens in a situation with multiple files. So I have to reproduce it with a repo.
// We can quickly address your report if:// - The code sample is short. Nearly all TypeScript bugs can be demonstrated in 20-30 lines of code!// - It doesn't use external libraries. These are often issues with the type definitions rather than TypeScript bugs.// - The incorrectness of the behavior is readily apparent from reading the sample.// Reports are slower to investigate if:// - We have to pare too much extraneous code.// - We have to clone a large repo and validate that the problem isn't elsewhere.// - The sample is confusing or doesn't clearly demonstrate what's wrong.
🙁 Actual behavior
Notice that in src/spec.ts, Line 25 to 35
The infer2(outerIdWithSymbol) should not error but behaves the same as infer2(innerIdWithSymbol).
// changing exportinterfaceToInferWithSymbol<T=any>extendsSymbol{}// toexportinterfaceEmpty{}exportinterfaceToInferWithSymbol<T=any>extendsEmpty{}// can fix it// but this also has the problemexportinterfaceNotEmpty{a?: number;}exportinterfaceToInferWithSymbol<T=any>extendsNotEmpty{}
🙂 Expected behavior
The two object(innerIdWithSymbol and outerIdWithSymbol) from different folder with same type Identifier<Target> behaves consistently.
The text was updated successfully, but these errors were encountered:
TotooriaHyperion
changed the title
Objects with the same type from different folders have different behavior.
Objects with the same type from different files have different behavior.
Nov 17, 2021
It will behave the same as outerIdWithSymbol. The reason is that the type of innerIdWithSymbol is narrowed to a unique symbol, instead of IdentifierWithSymbol<Target>. There are some discussions in #46731.
PS: You can use Bug Workbench to reproduce bug with mutiple files.
Bug Report
Objects with the same type from different files have different behavior.
It happens when the type extends a type that is not Empty.
🔎 Search Terms
Actually, the problem is so weird that as a non-native English speaker, I don't know what keyword I should use to search.
I can only find something like duplicated type declarations from multiple files etc...
🕗 Version & Regression Information
typescript: 4.4.4
tslib: 2.3.1
I just find that inconsistent behavior.
Add: Just checked all my recently used versions, this happens from(but not starts at, because I haven't used this code at versions that are lower than 4.1.3) [email protected] to [email protected].
⏯ Playground Link
It only happens in a situation with multiple files. So I have to reproduce it with a repo.
https://github.com/TotooriaHyperion/maybe-ts-bug
💻 Code
https://github.com/TotooriaHyperion/maybe-ts-bug
🙁 Actual behavior
Notice that in src/spec.ts, Line 25 to 35
The infer2(outerIdWithSymbol) should not error but behaves the same as infer2(innerIdWithSymbol).
🙂 Expected behavior
The two object(innerIdWithSymbol and outerIdWithSymbol) from different folder with same type Identifier<Target> behaves consistently.
The text was updated successfully, but these errors were encountered: