TypeScript/tests/baselines/reference/nonnullAssertionPropegatesContextualType.types

11 lines
900 B
Plaintext

=== tests/cases/compiler/nonnullAssertionPropegatesContextualType.ts ===
let rect2: SVGRectElement = document.querySelector('.svg-rectangle')!; // Error: Element
>rect2 : SVGRectElement
>document.querySelector('.svg-rectangle')! : SVGRectElement
>document.querySelector('.svg-rectangle') : SVGRectElement | null
>document.querySelector : { <K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null; <K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null; <E extends Element = Element>(selectors: string): E | null; }
>document : Document
>querySelector : { <K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null; <K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null; <E extends Element = Element>(selectors: string): E | null; }
>'.svg-rectangle' : ".svg-rectangle"