typescriptvisual-studio-codeintellisense

How to see a fully-expanded TypeScript type without "N more" and "..."?


In VSCode, TypeScript shows really useful expansions of types I define. But there's a limit to what TS will show in IntelliSense. If a type is too long, then I'll see output like this:

enter image description here

Note the "11 more" near the end. Sometimes, for troubleshooting a difficult type definition, it's really helpful to see what's in that "N more" section.

Is there a way to get ahold of (for troubleshooting purposes during development) the fully-expanded type definition, without those "N more" messages to hide what's inside?

https://github.com/Microsoft/vscode/issues/6638 implies that this capability might not have been available (nor planned) as of Feb 2017, but I'm not sure I'm reading that issue correctly and regardless things may have changed in the meantime.


Solution

  • Try setting the noErrorTruncation option to true in tsconfig.json. Confusingly enough, this option affects truncation of types displayed on hover in at least some circumstances; see this issue. Be careful: if your type is really huge, VS Code may hang when you try to view it.