Expanded TypesDeep-expand TypeScript types directly in hover tooltips. Instead of seeing an opaque type alias like FeaturesFull type expansion on hoverWhen enabled, hovering over any identifier replaces the standard TypeScript tooltip with a fully-resolved version of its type. Before:
After:
What gets expanded
Nullish members ( Status bar toggleA status bar item in the bottom-right corner shows the current state and toggles expansion with a single click:
Copy expanded typeThe Expanded Types: Copy Expanded Type at Cursor command copies the expanded type text to your clipboard — useful for pasting into documentation, issue reports, or type annotations. Original JSDoc preservedBy default, the original JSDoc comment is shown above the expanded block. This can be disabled with the Requirements
No additional dependencies or build tools required. InstallationFrom the Marketplace
Or search "Expanded Types" in the Extensions view ( From a VSIX file
Getting Started
ConfigurationAll settings live under the
Example
|
| Value | Use case |
|---|---|
1–2 |
Only expand the top-level shape; aliases for deeply nested types stay opaque |
5 (default) |
Good balance for most codebases |
8–10 |
Deep generics and layered domain models |
20 |
Maximum — may produce very long tooltips on complex types |
When the depth limit is reached, the tooltip shows { … } for objects, [ … ] for tuples, rather than expanding further.
Commands
Access these from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | ID | Description |
|---|---|---|
| Expanded Types: Toggle | expandedTypes.toggle |
Enable or disable type expansion |
| Expanded Types: Copy Expanded Type at Cursor | expandedTypes.copyAtCursor |
Copy the expanded type at the cursor to the clipboard |
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+Alt+E |
Toggle type expansion on/off |
You can rebind this in File → Preferences → Keyboard Shortcuts by searching for expandedTypes.toggle.
How It Works
Expanded Types uses the TypeScript Language Service Plugin API to intercept hover requests at the TypeScript server level.
- The VS Code extension registers a tsserver plugin (
expanded-types-plugin) viatypescriptServerPluginsin its manifest. - When enabled, the plugin overrides
getQuickInfoAtPositionin the TypeScript language service. - For each hover request, the plugin walks the TypeScript type graph using the type checker and recursively resolves all properties, union members, and signatures.
- The resolved type string is injected into the hover response as a Markdown code block.
- The extension communicates configuration changes (enabled state, maxDepth, keepOriginalDocs) to the plugin in real time via the TypeScript extension API — no restart needed.
Troubleshooting
The status bar shows ⚠ TS: Not connected
This means the extension could not reach the TypeScript server API. Try:
- Opening a
.tsor.tsxfile (the extension activates on TypeScript/JavaScript files only) - Clicking the status bar or pressing
Ctrl+Alt+Eto toggle — this retries the connection - Reloading the VS Code window (
Ctrl+Shift+P→ Developer: Reload Window)
Hover looks the same after enabling
- Make sure a TypeScript file is active (not a JSON, Markdown, etc. file)
- Check the Expanded Types output channel (
Ctrl+Shift+P→ View: Toggle Output → select Expanded Types) for diagnostic messages - Try reloading the window once after first install — the tsserver plugin loads on server start
The expanded type is very long
Reduce expandedTypes.maxDepth in your settings. A value of 3 or 4 keeps output compact for most types.
Known Limitations
- Function overloads: Only the first call signature is expanded.
- Mapped types with complex key remapping: May fall back to
checker.typeToString()output. - Very large types: Deep expansion of types with dozens of properties and high
maxDepthcan produce long tooltips. VS Code truncates hovers beyond a certain size. - JavaScript files: Expansion works but is limited by how much type information the TypeScript checker infers from plain JS.
Contributing
Bug reports and pull requests are welcome at github.com/crision-olt/vscode-expanded-types.
# Clone and install
git clone https://github.com/crision-olt/vscode-expanded-types.git
cd vscode-expanded-types
npm install
# Build
npm run build
# Run tests
npm test
# Watch mode (rebuilds on save)
npm run watch
To test the extension locally, press F5 in VS Code to open an Extension Development Host.
License
MIT