File tree Expand file tree Collapse file tree
internal/rules/no_unnecessary_type_assertion Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -483,6 +483,28 @@ declare const document: {
483483};
484484
485485export const a = document.querySelector('.foo') as HTMLCanvasElement | null;
486+ ` },
487+ {
488+ Code : `
489+ interface Element { tagName: string; }
490+
491+ interface HTMLCanvasElement extends Element { getContext(contextId: string): unknown; }
492+
493+ interface Factory { new <E extends Element = Element>(): E | null; }
494+
495+ declare const CanvasFactory: Factory;
496+
497+ export const a = new CanvasFactory() as HTMLCanvasElement | null;
498+ ` },
499+ {
500+ Code : `
501+ interface Element { tagName: string; }
502+
503+ interface HTMLCanvasElement extends Element { getContext(contextId: string): unknown; }
504+
505+ declare const query: { <E extends Element = Element>(strings: TemplateStringsArray): E | null; };
506+
507+ export const a = query` + "`" + `.foo` + "`" + ` as HTMLCanvasElement | null;
486508 ` },
487509 {Code : `
488510type NumberValueType = number | string;
You can’t perform that action at this time.
0 commit comments