-
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
infer recursive type (Typescript) #23433
Comments
The recursive type is inferred correctly. the issue is how it is printed when you hover over it. First type aliases are not types, they are just aliases. in other words the compiler replaces every reference to them with the actually type. |
Inference is actually yielding the expected type Type<{ prop1: Type<String>, prop2: Type<{ subprop: Type<String> }> }> The issue is simply that when displaying the type, the compiler only goes a couple of levels deep before substituting an |
@mhegazy that was what i thought since i got a compile error. is there a way to rewrite (my code red) that so it displays the correct type when hovering? |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
From @MikkelSnitker on April 16, 2018 17:25
Hi.
I'm not sure if this is a bug/feature in vscode or in typescript, but recursive types resolves to any?
Giving the code below TestType3 resolves to:
TypeScript Type<{prop1: Type<String>,prop2: Type<any>}>
and not as i expected
TypeScript Type<{prop1: Type<String>,prop2: Type<{subprop: Type<String>}>
I'm not sure if this is a typescript issue, but the compiler catches the error if prop2 does not contain a string property with the name subprop.
Does this issue occur when all extensions are disabled?: Yes
Regards Mikkel
Copied from original issue: microsoft/vscode#47984
The text was updated successfully, but these errors were encountered: