-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Order of ReadonlySet/ReadonlyMap in union causes differing key inferenceΒ #52313
Copy link
Copy link
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosThis issue has compiler-backed repros: https://aka.ms/ts-reprosUnion Order DependenceTS behavior is not supposed to depend on union order, but sometimes doesTS behavior is not supposed to depend on union order, but sometimes does
Milestone
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionHas ReproThis issue has compiler-backed repros: https://aka.ms/ts-reprosThis issue has compiler-backed repros: https://aka.ms/ts-reprosUnion Order DependenceTS behavior is not supposed to depend on union order, but sometimes doesTS behavior is not supposed to depend on union order, but sometimes does
Bug Report
π Search Terms
ReadonlyMap ReadonlySet key inference
π Version & Regression Information
β― Playground Link
Playground Link
π» Code
π Actual behavior
The order of the union appears to matter, breaking inference and erroring on valid code. Swapping the union order allows the code to compile.
π Expected behavior
All of this should compile; the union ordering should not matter.