-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[5.4 regression] Broken relation of deferred index type over a mapped type on the source side #57188
Comments
Can we get a smaller repro? π |
Lol. That's a crazy long repro. When trying to understand what's going on, I found that I also found that changing the definition of |
The best I can get now is this: TS playground. I doesn't minimize it by a lot though. At this point almost everything that I remove makes the error go away. That said, I will investigate this within the internals and compare the current and old execution paths to learn more about this. That might make it possible for me to create a smaller repro. I just need to find some time for this deep dive. |
It turns out that #56742 isn't exactly the culprit here. I think that once it landed it led to some weird situation in which it errored incorrectly ( The additional problem was this incorrect PR of mine ( #57202 ) that was recently reverted here #57202 . We can go back to TS 5.0 (that predates the PR that was reverted) to see a different error: TS playground What happens here is that the base constraint of It's known that The fix for this is straightforward on my side. I can introduce a temporary infer type variable ( it is kinda cheating here because it doesn't really fix the base constraint of the
type Target = string | undefined
type Source = Invert<TChildrenMap> extends infer TInverted ? keyof TActors & string extends keyof TInverted ? TInverted[keyof TInverted & keyof TActors & string] : string | undefined : never
type SourceConstraint = keyof TActors & string extends never ? never : string | undefined
type Result = SourceConstraint extends Target ? 1 : 0 // 1 Alternatively, I can just add Case closed. |
π Search Terms
deferred index mapped type apparent keys
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?noErrorTruncation=true&ts=5.4.0-dev.20240110#code/PTAEAEDsHsFECd7XgFXgV0gYwIYBcBLaSALlDwwFMAoPATwAdLQA1HAG3UoGcAeFAHygAvKBQBtANaU60AGZiAugG5ajZgEluAOUoA3SvH5DR4lItCUAHnkqQAJt1DjI+wxYD85KqDJyO3JSq9EygAMI43Hi8AIIANKAAQiagMZY2do5JoF5pZInB6uHQALYM6Lax6bYOTjiQdCkA3s4A0qAEkKDSsgoximQx4q0WAL6gAGSgmJIwAO6QhaEakAbw0SjVmU4ASpRYy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D15Vqg4F-JRqDw-gbh-jA14gdALRdDWZ3ZMYt2JooLhnq8NzLOEmz6eesh2kF0Oc9WQwNhdt3y+btY28LvWiQEf469c030dpmuvzA-q+TBNCcMw5g5EweEiC6QI8HQBhtaF0MbYc3Z9i2-2nZo3vXf73bPdgyDLZ10-9cNg-jZ24fDJSEKJIECUg60iOJNGX7BRsm4M1WOoAZJKRGs1E+ECi5EknmBH+acQH+WGO8boMgvip24KDa2GdBRT31AA6SWEiKkXAa4BsRpQAEVIWRCiW9XgRCiAwl6Q1T78HVlNdKWtoEJTPgwBIWCBA33enbE2hkL58TPKPautl-KHVAH1VQQA
π» Code
π Actual behavior
It fails to be checked
π Expected behavior
The used
Cast
should be enough to satisfy the constraintAdditional information about the issue
We can get rid off the error (but lose functionality):
id
fromToProvidedActor
Compute
fromToChildren
Compute
ExtractLiteralString
filter~ fromToConcreteChildren
cc @weswigham (since it's a change from #56742 )
The text was updated successfully, but these errors were encountered: