they could have provided a seperate api over top of this and error’d on use? It’s a clearly error-prone api.
Also, Typescript is adding types on top of the JavaScript language, not the DOM API.
Think about what is happening. When you build to the browser as a target, TSC basically transpiles the TypeScript code to JavaScript. The Browser APIs that Typescript provides are a bunch of type definitions. When it transpiles the code the only thing it can really do is check the types match up.