Closed bravo-kernel closed 1 year ago
Hmmm... The error does make sense to me. String.split()
returns an array of strings and the second element of this array indeed can be undefined
But:
String.split()
is?This is a false positive because of this protective measure just above:
but I would still like to know more.
Thanks for responding. I am using Typescript 4.9.4
and will try to follow-up on your questions.
I have created a fresh project at https://github.com/bravo-kernel/debug-get-user-locale.
Then added get-user-locale
line here.
If you run npx tsc
you will see the error.
Aaaah, thank you for this.
The key here is noUncheckedIndexedAccess
. When turned on, you'll get the error. TypeScript disregards the safety checks I have put in place and throws this error.
Related: https://github.com/microsoft/TypeScript/issues/41638
Cool, good that we both are seeing the same. Are you suggesting that I turn off noUncheckedIndexedAccess
(which is not an option)?
Not at all :D Just thinking out loud.
Released in v2.1.2. Thank you for this!
Perfect, much appreciated 💃
Any pointers on what might cause below CI error when using v2.1.1: