* Explore using a different isArray declaration * Add tests and the new isArray definition * Baseline updates * Upda the isArray type
24 lines
797 B
Text
24 lines
797 B
Text
=== tests/cases/compiler/isArray.ts ===
|
|
var maybeArray: number | number[];
|
|
>maybeArray : number | number[]
|
|
|
|
|
|
if (Array.isArray(maybeArray)) {
|
|
>Array.isArray(maybeArray) : boolean
|
|
>Array.isArray : <T>(arg: {} | T) => arg is T extends readonly any[] ? unknown extends T ? never : readonly any[] : any[]
|
|
>Array : ArrayConstructor
|
|
>isArray : <T>(arg: {} | T) => arg is T extends readonly any[] ? unknown extends T ? never : readonly any[] : any[]
|
|
>maybeArray : number | number[]
|
|
|
|
maybeArray.length; // OK
|
|
>maybeArray.length : number
|
|
>maybeArray : number[]
|
|
>length : number
|
|
}
|
|
else {
|
|
maybeArray.toFixed(); // OK
|
|
>maybeArray.toFixed() : string
|
|
>maybeArray.toFixed : (fractionDigits?: number) => string
|
|
>maybeArray : number
|
|
>toFixed : (fractionDigits?: number) => string
|
|
}
|