-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The following example causes TypeError:
// const arr: string[]
const arr = ['a'];
if (hasLength(arr, 1)) {
// README claims: arr: readonly [string]
// but actually: arr: string[] & readonly [string]
arr.shift();
const str: string = arr[0];
// TypeError: Cannot read properties of undefined (reading 'length')
console.log(str.length);
}
with tsconfig.json:
{
"compilerOptions": {
// ...
"strict": true,
"exactOptionalPropertyTypes": true,
"noUncheckedIndexedAccess": true,
// ...
}
}
>npx tsc --version
Version 4.9.5
>node --version
v18.14.2
uhyo
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request