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
{{ message }}
Repository navigation
Can not infer not null / undefined when use enum as the optional key #30714
enumA{a,b,c}typeb=A.a|A.bconsta: {[keyinA]?: {[keyinA]?: string}}={[A.a]: {[A.a]: "a"}}functiont(){// below line will have error on a[A.a][A.a] for possibly `undefined` when enabled `strictNullChecks`if(a[A.a]&&a[A.a][A.a]){returna[A.a][A.a];}return}
Expected behavior:
no err when enable strictNullChecks, as the undefined should be ruled out after first a[A.a] check.
Activity
RyanCavanaugh commentedon Apr 2, 2019
Duplicate #28081
typescript-bot commentedon Apr 5, 2019
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
jcalz commentedon Dec 23, 2019
The fix for #28081, namely #31478, did not address enum keys; should this be reopened or should a new issue be filed?