Closed
Description
TypeScript Version: 2.6.3
Code
let result = document.querySelector('div'); // result is HTMLDivElement
// compiles
let result1 = document.querySelector<HTMLDivElement>('div'); // result1 is HTMLDivElement
// error TS2344: Build:Type 'HTMLDivElement' does not satisfy the constraint '"symbol" | "object" | "track" | "progress" | "a" | "applet" | "area" | "audio" | "base" | "basefo...'.
let result2 = document.querySelector<HTMLDivElement>('div[id][data-foo]');// result1 is HTMLDivElement
//error TS2344: Build:Type 'HTMLDivElement' does not satisfy the constraint '"symbol" | "object" | "track" | "progress" | "a" | "applet" | "area" | "audio" | "base" | "basefo...'.
let result3 = document.querySelector('div[id][data-foo]'); // result3 is Element 8-/
// compiles
Expected behavior:
All four lines should compile. VS highlighting and playground do not show errors.
Actual behavior:
TS2344 is shown, compile aborts.
querySelectorAll has the same problem.
introduced in #12568