You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Provide an option to configure the presentation of ArraysΒ #44715
I would like to see an option that will allow for altering the presentation of Arrays.
π Motivating Example
When reading through type errors or hovering over source code in VS Code, I find it hard to easily distinguish between Arrays, Tuples, Arrays of Tuples, Tuples with Arrays in them etc.
I personally use linting rules so that I know that when I see a [ or ] in my source code, I am explicitly dealing with a Tuple.
For example, I find Array<[Array<T>]> far easier to quickly parse than [T[]][]. This may simply be attributed to my bias of writing code in the generic form. Though, this gets worse with increased levels of nesting.
π¨ Prior art
The tslint rule array-type can be used to enforce using the generic form of Array<T>. Secondarily, this rule was also ported as the @typescript/eslint rule array-type.
π» Use Cases
I find hovering over my own code and seeing it presented differently a bit frustrating. Consider the following playground screenshot:
I'm definitely plus-one on this, although for code authored by the user I think it probably doesn't even need configuration, just show the type as authored rather than regenerating a presentation. i.e. If I write string[] show string[], if I write Array<string> show Array<string>.
Obviously this doesn't neccessarily work for library code, so an option would probably be necessary for that.
Activity
Jamesernator commentedon Jun 24, 2021
I'm definitely plus-one on this, although for code authored by the user I think it probably doesn't even need configuration, just show the type as authored rather than regenerating a presentation. i.e. If I write
string[]showstring[], if I writeArray<string>showArray<string>.Obviously this doesn't neccessarily work for library code, so an option would probably be necessary for that.