Coder Social home page Coder Social logo

webgl.d.ts's People

Contributors

ricop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

webgl.d.ts's Issues

interface WindowAnimationTiming

Your definition of the interface WindowAnimationTiming from lines 517 to 529 clashes with the definition of the same in the updated lib.d.ts which comes with TypeScript 0.8.1:

C:/Program Files (x86)/Microsoft SDKs/TypeScript/0.8.1.0/lib.d.ts(6874,4): Signature for 'msCancelRequestAnimationFrame' is duplicated

Yours is better because it contains the prefixed declarations for Firefox and Chrome etc. but I'm not sure whether it's safe to edit lib.d.ts without recompiling the TypeScript compiler.

Loose type checking on empty interfaces

WebGL defines a bunch of emtpy interfaces to mark different types of WebGL objects that apparently have no methods. TypeScript treats interfaces with identical fields as compatible, which allows to pass for example WebGLProgram where WebGLShader is required. Actually it allows to pass any object really, because any object implements all empty interfaces. That's not cool cause we are using TypeScript to force type correctness ;).

My proposition is to translate empty every interface to declare class construct which tightens type checking. The other solution is to leave interfaces as interfaces and add an auto-generated field based on interface name. That's not pretty but it's some alternative if one is needed.

First variant looks like this:

declare class WebGLObject {
};


declare class WebGLBuffer extends WebGLObject {
};


declare class WebGLFramebuffer extends WebGLObject {
};


declare class WebGLProgram extends WebGLObject {
};


declare class WebGLRenderbuffer extends WebGLObject {
};


declare class WebGLShader extends WebGLObject {
};


declare class WebGLTexture extends WebGLObject {
};


declare class WebGLUniformLocation {
};

The second looks like this:

interface WebGLObject {
    ___WebGLObject_: any;
};


interface WebGLBuffer extends WebGLObject {
    ___WebGLBuffer_extends_WebGLObject_: any;
};


interface WebGLFramebuffer extends WebGLObject {
    ___WebGLFramebuffer_extends_WebGLObject_: any;
};


interface WebGLProgram extends WebGLObject {
    ___WebGLProgram_extends_WebGLObject_: any;
};


interface WebGLRenderbuffer extends WebGLObject {
    ___WebGLRenderbuffer_extends_WebGLObject_: any;
};


interface WebGLShader extends WebGLObject {
    ___WebGLShader_extends_WebGLObject_: any;
};


interface WebGLTexture extends WebGLObject {
    ___WebGLTexture_extends_WebGLObject_: any;
};


interface WebGLUniformLocation {
    ___WebGLUniformLocation_: any;
};

I've created a gist with my parser for the record but I believe your parser idl2typings is more robust. (Mine is regexp-based and was hacked in one evening ;) .) https://gist.github.com/91b49468eedb09aceaee

issues with modern TS linter

To keep the TypeScript linter (4.7.3) happy I needed to rename bool to boolean and understand definition for FrameRequestCallback. Any help on the later would be much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.