@@ -138,6 +138,11 @@ ruleTester.run('array-type', rule, {
138
138
}` ,
139
139
options : [ 'array' ]
140
140
} ,
141
+ {
142
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
143
+ code : 'type Unwrap<T> = T extends (infer E)[] ? E : T' ,
144
+ options : [ 'array' ]
145
+ } ,
141
146
{
142
147
code : `let z: Array = [3, "4"];` ,
143
148
options : [ 'generic' ]
@@ -173,6 +178,11 @@ ruleTester.run('array-type', rule, {
173
178
{
174
179
code : `type fooIntersection = Array<string & number>;` ,
175
180
options : [ 'generic' ]
181
+ } ,
182
+ {
183
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
184
+ code : 'type Unwrap<T> = T extends Array<infer E> ? E : T' ,
185
+ options : [ 'generic' ]
176
186
}
177
187
] ,
178
188
invalid : [
@@ -774,6 +784,34 @@ let yyyy: Arr<Array<Array<Arr<string>>>> = [[[["2"]]]];`,
774
784
column : 19
775
785
}
776
786
]
787
+ } ,
788
+ {
789
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
790
+ code : 'type Unwrap<T> = T extends Array<infer E> ? E : T' ,
791
+ output : 'type Unwrap<T> = T extends (infer E)[] ? E : T' ,
792
+ options : [ 'array' ] ,
793
+ errors : [
794
+ {
795
+ messageId : 'errorStringArray' ,
796
+ data : { type : 'T' } ,
797
+ line : 1 ,
798
+ column : 28
799
+ }
800
+ ]
801
+ } ,
802
+ {
803
+ // https://github.com/typescript-eslint/typescript-eslint/issues/172
804
+ code : 'type Unwrap<T> = T extends (infer E)[] ? E : T' ,
805
+ output : 'type Unwrap<T> = T extends Array<infer E> ? E : T' ,
806
+ options : [ 'generic' ] ,
807
+ errors : [
808
+ {
809
+ messageId : 'errorStringGeneric' ,
810
+ data : { type : 'T' } ,
811
+ line : 1 ,
812
+ column : 28
813
+ }
814
+ ]
777
815
}
778
816
]
779
817
} ) ;
0 commit comments