VSCode extension that allows you to expand TypeScript type definitions.
- Displays the type information of the selected node
- This is especially useful for hard-to-read types, such as those automatically generated from GraphQL schemas.
You can install this extension from the ts-type-expand - Visual Studio Marketplace!
There is nothing additional that needs to be installed.
If tsconfig.json
is not directly under your workspace, specify the path with the ts-type-expand.tsconfigPath
option. See Configure for other valid options.
The following types can be expanded
- Properties
- Array (
T
forArray<T>
) - Candidate types for union type
- Arguments and return values of functions or methods
The following are the destination nodes that support type expansion. More nodes will be added in the future.
Statements | Support |
---|---|
TypeAlias declaration | ✓ |
Interface declaration | ✓ |
Varibale declaration | ✓ |
Varibale statement | ✓ |
Class declaration | ✓ |
Function declaration | ✓ |
Function call | ✓ |
Function argument | ✓ |
Method declaration | ✓ |
Enum Declaration | ✓ |
Enum statement | ✓ |
Types are calculated by the CompilerAPI, so all types supported by TypeScript are supported in this extension.
- Vue is not supported (not tried)
- React also works, but there can be problems with component types
Configure ts-type-expand.*
to your vscode config to customize.
key | value | default |
---|---|---|
tsconfigPath |
Path for tsconfig.json |
tsconfig.json |
compactOptionalType |
display T? for type T | undefined |
true |
compactPropertyLength |
Omit when the type can be expanded and the number of characters of the type is longer than this length. | 10 |
directExpandArray |
Directly expand T for Array<T> | true |
In order for these settings to take effect, you need to run ts-type-expand.restart
or reload the VSCode after making the changes.
command | effect |
---|---|
ts-type-expand.restart |
Update configuration and restart extension |
MIT