-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed as not planned
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
🔎 Search Terms
Array.isArray( )
🕗 Version & Regression Information
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
💻 Code
// from: ms-vscode.vscode-typescript-next-5.9.20250307\node_modules\typescript\lib\lib.es5.d.ts
interface ArrayConstructor {
new (arrayLength?: number): any[];
new <T>(arrayLength: number): T[];
new <T>(...items: T[]): T[];
(arrayLength?: number): any[];
<T>(arrayLength: number): T[];
<T>(...items: T[]): T[];
isArray(arg: any): arg is readonly any[]; // <== fix the Array.isArray() ✅
isArray(arg: any): arg is any[];
readonly prototype: any[];
}
//ex: this will work fine now
public hasStatus( entityWithStates: EntityWith<C.StatesComponent>, status: STATUS | readonly STATUS[] ) {
const { statesMap } = entityWithStates.get( C.StatesComponent ).read;
return Array.isArray( status ) ? status.some( ( _status ) => statesMap.has( _status ) ) : statesMap.has( status );
}🙁 Actual behavior
🙂 Expected behavior
support readonly array when do a Array.isArray()
Additional information about the issue
No response
VitorLuizC and lukeapage
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
