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
Actual behavior:
with strictNullChecks, fails to compile:
foo.ts(17,29): error TS2345: Argument of type '"email"' is not assignable to parameter of type 'never'.
foo.ts(18,30): error TS2345: Argument of type '"email"' is not assignable to parameter of type 'never'.
works without strictNullChecks:
foo
undefined
The text was updated successfully, but these errors were encountered:
Actually, this isn't a duplicate, but more like a suggestion that we somehow permit indexed access types to work on types that include undefined and/or null. It would probably require a new type operator, e.g. T!, which removes undefined and null from the type of T. We could then say that when a truthy, undefined, or null check is applied to an expression of a generic type T, we produce the type T! in order to record the knowledge that the type is not nullable.
Anyway, I'm going to reopen and change to a suggestion.
TypeScript Version: 2.1.4
Code
Expected behavior:
Expect to output:
Actual behavior:
with strictNullChecks, fails to compile:
works without strictNullChecks:
The text was updated successfully, but these errors were encountered: