-
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
typeAlias = type, however, definition to convert types resolution into a hierarchy(Tree) for enhanced display, granularity control #24520
Comments
Type aliases are just that, aliases. the compiler aggressively inline their values when using them. that is why for instance a type alias can not reference itself. This is a design choice that we have made a while back, this allows the compiler to save memory storing an additional object of every type alias, but more importantly save time, since comparing two type does not have to delve through their alias chain. |
you might find #15807 interesting for your use case. |
@mhegazy Thanx I will take a look into that, unique structural wrappers, identifier and a random symbols for safety. When you say design limitation, would be not be able to write additional integration tools, to inspect AST for VSCode? I am were the limitation would be determine at which layer and stage the AST be being consumed/interrogated by VSCode? A littler bit off topic here: Is the a drop in manual for getting upto speed with the internals of the typescript repository? |
this is not the AST. this is the type that the compiler inferred.
take a look at https://github.com/Microsoft/TypeScript/wiki/Architectural-Overview and https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
The ability to allow type resolution of typescript for design time behaviour to not always resolve down to its base primitives, would help in communicate which type names should be used at the different layers of code composition. It would be nicer to see a modules type or an alternative internal named type instead of a primitive type. Currently this can be achieved by using interface names, however, I do feel it can be clumb some and potentially with structural typing not always a good thing.
It would be great to just define alias type using 'typeAlias', instead other more detail methods previously mention and similar to other languages, which is used to control the granularity.
When a type is resolved I would imagine that it would be presented in graphical tree eventually,
were the first typeAlias or interface token/node encountered would be the top level entry. Their after any typeAlias definitions on the path to resolving a type to its primitive are added as child elements.
This would allow the operator to decide the level of detail nessary to resolve his typing issues and peel back as many type layers as required, by expanding the child items.
[] Square brackets communicate this is a resolved type and their are potentially many types between this and the primitive.
It may still be useful to show all type redefinition for debugging purposes, in which case a different tree child symbol could be used, which is clickable on to communicate this. !->
Examples:
Case 1
Code
Tree:
Case 2
Code
Tree:
Case 3
Code
Tree:
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: