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
constKEY_REGEX=/^--(.*)/;constargs: string[]=["--active","--number","1"];// errorconstindex=0;if(args[index+1]&&KEY_REGEX.test(args[index+1])){}// errorconstnextIndex=index+1;if(args[nextIndex]&&KEY_REGEX.test(args[nextIndex])){}// no error - can be used as workaroundconstnextItem=args[nextIndex];if(nextItem&&KEY_REGEX.test(nextItem)){}
π Actual behavior
If we do an check by index, we get the following error:
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'. (2345)
π Expected behavior
No error
Additional information about the issue
This only happens if the noUncheckedIndexedAccess option is set to true
The text was updated successfully, but these errors were encountered:
π Search Terms
π Version & Regression Information
4.1
when thenoUncheckedIndexedAccess
option was addedβ― Playground Link
https://www.typescriptlang.org/play?noUncheckedIndexedAccess=true&target=7&module=6&noFallthroughCasesInSwitch=true&ts=5.4.0-dev.20231202#code/MYewdgzgLgBA0gUQJoH0BKCDiCAaMC8MA9AHoC0ZAFAHQBUAlEQNwBQoksAhgE4DmEALhjRuASzC8A2gF0CMSQCIKnYFFEA3AKYKANDCVkwAVwC2AI03dd+gIwLprNuGgxxAE00APOQAZWogDNKHn5Jdy8YAGoYG1kAMjj4ZHQsXGooTWhgvggwsA9vaNj6ehgAbwBfFicOGDAvKABJfIjCcMKY-wCYbND6zyaWz3jExFQMbBx0zKhe3P7BgukS8qqalwXGjJM5EPmG5qWuns3tmASk8dSpjKzTzRMVyqA
π» Code
π Actual behavior
If we do an check by index, we get the following error:
π Expected behavior
No error
Additional information about the issue
This only happens if the
noUncheckedIndexedAccess
option is set to trueThe text was updated successfully, but these errors were encountered: