You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know that new Array(n) generates an array with length and undefined items. But I also use fill and fixed types. I don't know how to avoid this error. Cast to number[] does also not work (unsafe cast).
Ok thanks. Disabling noUncheckedIndexedAccess works.
But are there other options? I mean the array declaration is safe without undefined items withing the given length (in this case). Can I force the not nullish type like with ! or something like that?
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
π Search Terms
array is possible undefined
π Version & Regression Information
Tested with
typescript@next
(4.6.0-dev.20211216). I initially came from 4.2.4.β― Playground Link
Playground does not work for this.
π» Code
π Actual behavior
I get an error
Object is possiible 'undefined'.
π Expected behavior
I know that
new Array(n)
generates an array with length and undefined items. But I also usefill
and fixed types. I don't know how to avoid this error. Cast tonumber[]
does also not work (unsafe cast).tsconfig.json (click to expand)
The text was updated successfully, but these errors were encountered: