Repository: TypeScript
Issue:  Compiler Option typeTruncationLength
Labels: Suggestion,Awaiting More Feedback

### 🔍 Search Terms

"type truncation truncate compiler option "

### ✅ Viability Checklist

- [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [X] This wouldn't change the runtime behavior of existing JavaScript code
- [X] This could be implemented without emitting different JS based on the types of the expressions
- [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [X] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [X] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

### ⭐ Suggestion

New Compiler Option for tsconfig: `typeTruncationLength: number`
The specified number is the amount of characters that will be shown before an ellipsis cutoff happens.
set to 1600 characters by default.
special value 0 means truncation is disabled completely.

### 📃 Motivating Example

I need type information to know what I am working with, especially when working with mapped or infered Types.
Preferably, I hover over the type or variable I want to inspect in visual studio code (or typescript playground).
This information inevitably gets truncated when it exceeds the built-in character limit of effectively 1600, even when setting noErrorTruncation to true (which shouldn't affect type information yet it does, see #26238)
You can manually adjust that limit by hacking tsserver.js in your vscode install location ([reference](https://github.com/Microsoft/TypeScript/issues/26238#issuecomment-672086446)).

I think that being able to receive complete type information in a language that's entire purpose is to add said thing to javascript is a core requirement.

This [code example](https://www.typescriptlang.org/play/?target=9&noErrorTruncation=true&ts=5.5.2#code/PTAEAkHsDcFMCdQwaWBDAxgC1AFwJ4AOsekoAzrCbliQCYCWAZkwrAHa57wCu7GaXA0jtQAI1hY00YfHKgphYuwbsA5qEF5aoDD1yQWSJqAB+ARgBsABmu6p8TLgTyA7gxqrtJPfAA2+OKOGADWsLjkAFCRwABUsQDCkAC2hH7h1EQkqkyQ8MmCwqKxwJEExNx8AkIiAEKQfHRo8IEAvKAA3pGgPaDw6HQiAZoAXKAARAAqHAkO5AC00+yzzQtLK3KLM3Nbyzvr+9ur8+MA3N29-WiD7MNiY1NHmwf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B7eGHh53OJcYniAA5MgUKqdDQFcPIQnkW6EHgPJQGSci0E-E7r04Dg4cByIMBEb9N2ISj4Br+AC8mUH0LGIu0MgiGmhaUB2gAeTEK1SNwAA6Jh+lgAAvWAAApGN6ZGY6D0mABpUyx2Or75c+UUJ6-vZ9cZb96cmH5dhsX56Wn369pEv+ZsfR+EUAFc1-oHRkAChbgIjv6ABEsYG20gameWiDnZwNTKrNBsdn6ph1tgk+uCUTG3DkgyOACrYEMfkQ3ojtSHoJJjQnoHsqHkNTP7VhPUAFh04YwgB0d6G8OJAAhOydn4LgAJRAA) might help exemplify the issue (switch noErrorTruncation on/off to see the different behaviors for onhover truncation).

### 💻 Use Cases

1. What do you want to use this for? The ability to see complete type information even for very complex or long types
2. What shortcomings exist with current approaches? Partial information entails extensive backtracking to the original interfaces/type definitions to see all fields and their types or intentionally causing type errors to see full information.
3. What workarounds are you using in the meantime? The aforementioned hack.