TypeScript Version: 2.4.2
Code
For this JavaScript with checkJs enabled:
// @ts-check
/**
* @type {HTMLImageElement}
*/
const el = document.querySelector("#definitelyAnImage");
el.src = "image.png";
Expected behavior:
Can cast result of document.querySelector which returns an Element to an HTMLImageElement
Actual behavior:
Error:
file: 'file:///Users/matb/projects/san/a.js'
severity: 'Error'
message: 'Type 'Element' is not assignable to type 'HTMLImageElement'.
Property 'align' is missing in type 'Element'.'
at: '5,7'
source: 'js'
TypeScript Version: 2.4.2
Code
For this JavaScript with
checkJsenabled:Expected behavior:
Can cast result of
document.querySelectorwhich returns anElementto anHTMLImageElementActual behavior:
Error: