TypeScript/tests/baselines/reference/narrowingWithNonNullExpression.types

28 lines
576 B
Plaintext

=== tests/cases/compiler/narrowingWithNonNullExpression.ts ===
const m = ''.match('');
>m : RegExpMatchArray
>''.match('') : RegExpMatchArray
>''.match : (regexp: string | RegExp) => RegExpMatchArray
>'' : ""
>match : (regexp: string | RegExp) => RegExpMatchArray
>'' : ""
m! && m[0];
>m! && m[0] : string
>m! : RegExpMatchArray
>m : RegExpMatchArray
>m[0] : string
>m : RegExpMatchArray
>0 : 0
m?.[0]! && m[0];
>m?.[0]! && m[0] : string
>m?.[0]! : string
>m?.[0] : string
>m : RegExpMatchArray
>0 : 0
>m[0] : string
>m : RegExpMatchArray
>0 : 0