Feature Request: Provide an option to configure the presentation of Arrays #44715
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Suggestion
Provide an option to configure the presentation of Arrays.
π Search Terms
Array<T>
T[]
This suggestion is hard to search forβΉοΈ
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
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 ofArray<T>
. Secondarily, this rule was also ported as the @typescript/eslint rulearray-type
.π» Use Cases
I find hovering over my own code and seeing it presented differently a bit frustrating. Consider the following playground screenshot:
In addition to
array-type
s options of"array"
,"generic"
,"array-simple"
, a fourth option of"preserve"
could be added which would address the screenshot above.I would like to suggest the following option:
--arrayType
"array" | "generic" | "array-simple" | "preserve"
"preserve"
The text was updated successfully, but these errors were encountered: