You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In lib.d.ts (TS 2.8.1) all the interfaces of WebGL objects like WebGLBuffer, WebGLTexture are empty, and so because of structural subtyping (duck typing), this code compiles without a problem:
let texture: WebGLTexture;
let buffer: WebGLBuffer = texture;
In lib.d.ts (TS 2.8.1) all the interfaces of WebGL objects like WebGLBuffer, WebGLTexture are empty, and so because of structural subtyping (duck typing), this code compiles without a problem:
An external typing file I used for WebGL types solves this by adding dummyprops to these interfaces, which is a little hacky but works:
https://github.com/asgerf/dartify/blob/master/testcases/pixi/webgl.d.ts
I know this is intended behaviour for TypeScript but I was wondering if there is a better way to enforce type safety in situations like this?
The text was updated successfully, but these errors were encountered: