Deferred resolution of object literal members to support recursive types.#550
Merged
ahejlsberg merged 4 commits intomasterfrom Sep 3, 2014
Merged
Deferred resolution of object literal members to support recursive types.#550ahejlsberg merged 4 commits intomasterfrom
ahejlsberg merged 4 commits intomasterfrom
Conversation
Contributor
|
👍 |
Contributor
|
Are there any back compat concerns here? Or does this preserve behavior between V1 and the current impl? Thanks! |
Member
Author
|
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 |
src/compiler/checker.ts
Outdated
Contributor
|
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. |
ahejlsberg
added a commit
that referenced
this pull request
Sep 3, 2014
Deferred resolution of object literal members to support recursive types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #523.
With this change the following declarations all create recursive types: