Fix to use more accurate types with custom isArray() and add lint (#5261)
* Fix to use more accurate types with custom isArray() * Add lint against Array.isArray()
This commit is contained in:
7
packages/codemirror-lsp-client/src/lib/utils.ts
Normal file
7
packages/codemirror-lsp-client/src/lib/utils.ts
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* A safer type guard for arrays since the built-in Array.isArray() asserts `any[]`.
|
||||
*/
|
||||
export function isArray(val: any): val is unknown[] {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
return Array.isArray(val)
|
||||
}
|
Reference in New Issue
Block a user