-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Deferred resolution of object literal members to support recursive types. #550
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
Conversation
👍 |
Are there any back compat concerns here? Or does this preserve behavior between V1 and the current impl? Thanks! |
For the declarations var a: { x: typeof a; };
var b: () => typeof b;
var c: { (): typeof c; };
var d: { [s: string]: typeof d; }; the old compiler would generate the types var a: { x: any; };
var b: () => any;
var c: { (): any; };
var d: { [s: string]: any; }; whereas the new compiler correctly generates recursive types. Technically the new behavior is stricter, but the old behavior is basically a bug (i.e. the spec never says that |
if (symbol.flags & (SymbolFlags.Function | SymbolFlags.Method)) { | ||
callSignatures = getSignaturesOfSymbol(symbol); | ||
if (symbol.flags & SymbolFlags.TypeLiteral) { | ||
// Type literal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment not needed
Please also test that this works in parameters, type parameter constraints, and type arguments. And I suppose eventually we will want to test tuple element types as well. |
Deferred resolution of object literal members to support recursive types.
Fixes #523.
With this change the following declarations all create recursive types: