-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Type alias substitution does not work #31616
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
Bug
A bug in TypeScript
Domain: Type Inference
Related to type inference performed during signature resolution or `infer` type resolution
Fix Available
A PR has been opened for this issue
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Comments
Regressed between 2.3 and 2.4 Removed suspect const v = { test: { smth: 5 } };
type Field<A extends string, R> = { [K in A]: R };
const f = <A extends string, B extends string, R>(x: { [K in A]: Field<B, R> } ): R => ({} as any);
const g = <A extends string, B extends string, R>(x: Field<A, Field<B, R>>): R => ({} as any);
const r1 = f(v); // number
const r2 = g(v); // unknown |
These are both |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
Bug
A bug in TypeScript
Domain: Type Inference
Related to type inference performed during signature resolution or `infer` type resolution
Fix Available
A PR has been opened for this issue
Rescheduled
This issue was previously scheduled to an earlier milestone
TypeScript Version: 3.5.0-dev.20190525
Search Terms:
type substitution is incorrect
Code
Expected behavior:
Both should be
number
.Actual behavior:
unknown
Playground Link:
Link
Related Issues:
Nope.
The text was updated successfully, but these errors were encountered: