Git Product home page Git Product logo

regl-typings's Introduction

๐Ÿฐ regl-typings

TypeScript typings for regl

TODO

  • Test it in JavaScript project, as opposed to TypeScript project.
  • Try createREGL in module-less, aka global environment.
  • Add typings for regl.read().
  • Support all ways to create/reinitialize a texture from arrays/typed arrays/ndarrays/framebuffers/textures. See https://github.com/regl-project/regl/blob/gh-pages/API.md#texture-constructor
  • Add typings for regl.texture({ copy: true }).
  • Add typings for REGL.Props.
  • Maybe introduce nested namespaces, like REGL.Drawing and REGL.Texture to decrease top-level module clutter.
  • Downgrade *Options from interfaces to object types.

In general, I see REGL.Command as a generic type parametrized by the type of its props, like so

interface MyCommandProps {
    color: [number, number, number, number];
}

const myCommand: REGL.Command<MyCommandProps> = regl({
    // ...
})

myCommand({
    colour: [1, 0, 0, 1], // This should err in compile time, because colour != color
}); 

React's component types are parametrized with the types of their props (and state, for stateful components). This allows for compile-time error checks regarding props' names and types, and that's a Good Thing.

regl-typings's People

Contributors

stevebest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.