@@ -17,6 +17,14 @@ describe('isArray return type', () => {
1717 expectTypeOf ( value ) . toEqualTypeOf < unknown > ( )
1818 }
1919 } )
20+ test ( 'value is never' , ( ) => {
21+ const value = { } as never
22+ if ( _ . isArray ( value ) ) {
23+ expectTypeOf ( value ) . toEqualTypeOf < never > ( )
24+ } else {
25+ expectTypeOf ( value ) . toEqualTypeOf < never > ( )
26+ }
27+ } )
2028 test ( 'value is string' , ( ) => {
2129 const value = { } as string
2230 if ( _ . isArray ( value ) ) {
@@ -25,28 +33,36 @@ describe('isArray return type', () => {
2533 expectTypeOf ( value ) . toEqualTypeOf < string > ( )
2634 }
2735 } )
28- test ( 'value is string or ReadonlyMap ' , ( ) => {
36+ test ( 'value is string or readonly string[] ' , ( ) => {
2937 const value = { } as string | readonly string [ ]
3038 if ( _ . isArray ( value ) ) {
3139 expectTypeOf ( value ) . toEqualTypeOf < readonly string [ ] > ( )
3240 } else {
3341 expectTypeOf ( value ) . toEqualTypeOf < string > ( )
3442 }
3543 } )
36- test ( 'value is string, ReadonlyMap , or Map ' , ( ) => {
44+ test ( 'value is string, readonly string[] , or string[] ' , ( ) => {
3745 const value = { } as string | readonly string [ ] | string [ ]
3846 if ( _ . isArray ( value ) ) {
3947 expectTypeOf ( value ) . toEqualTypeOf < readonly string [ ] | string [ ] > ( )
4048 } else {
4149 expectTypeOf ( value ) . toEqualTypeOf < string > ( )
4250 }
4351 } )
44- test ( 'value is string or Map ' , ( ) => {
52+ test ( 'value is string or string[] ' , ( ) => {
4553 const value = { } as string | string [ ]
4654 if ( _ . isArray ( value ) ) {
4755 expectTypeOf ( value ) . toEqualTypeOf < string [ ] > ( )
4856 } else {
4957 expectTypeOf ( value ) . toEqualTypeOf < string > ( )
5058 }
5159 } )
60+ test ( 'value is readonly [number, number] | number' , ( ) => {
61+ const value = { } as readonly [ number , number ] | number
62+ if ( _ . isArray ( value ) ) {
63+ expectTypeOf ( value ) . toEqualTypeOf < readonly [ number , number ] > ( )
64+ } else {
65+ expectTypeOf ( value ) . toEqualTypeOf < number > ( )
66+ }
67+ } )
5268} )
0 commit comments