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
In my code i get a Argument of type 'Definition | undefined' is not assignable to parameter of type 'Definition'. error. But as you see i check the object value with if (defs[type] != undefined). But at this.addDefinition(type, defs[type]); the error is thrown anyway.
The active option noUncheckedIndexedAccess will produces this error. But as you see there is a null check so that this error should not be thrown.
🙂 Expected behavior
Because of the null check this error should not be shown.
The text was updated successfully, but these errors were encountered:
For performance/correctness reasons we don't narrow when the key is a variable (we can't tell if it's been mutated or not). This limitation was called out in the PR text: #39560. noUncheckedIndexedAccess is extremely conservative in this regard.
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
In my code i get a
Argument of type 'Definition | undefined' is not assignable to parameter of type 'Definition'.
error. But as you see i check the object value withif (defs[type] != undefined)
. But atthis.addDefinition(type, defs[type]);
the error is thrown anyway.The active option
noUncheckedIndexedAccess
will produces this error. But as you see there is a null check so that this error should not be thrown.🙂 Expected behavior
Because of the null check this error should not be shown.
The text was updated successfully, but these errors were encountered: