Skip to content

Typescript definitions #953

Description

@NellWaliczek

When I've been feeling up for it, I've puttering with using threejs in a typescript project of mine and noticed that the WebXR types haven't been added to the built in typescript definitions. I'm not super familiar with how this is done, but it looks like it might be with this tool?

https://github.com/microsoft/TSJS-lib-generator

Perhaps someone wants to do that?

Activity

  1. klausw commented on Jan 21, 2020

    @klausw
    Contributor

    In case it's helpful, model-viewer uses Typescript, and I had updated its copy of types/webxr.ts as part of updating its WebXR support. That was fully manual, and only covered the parts of the API used by this application, so if there's a more automated way to generate the type mappings that would be strongly preferable. Is there a way to get this from IDL files directly?

  2. RaananW commented on Jan 24, 2020

    @RaananW

    We at Babylon.js maintain a webxr.d.ts as well - https://github.com/BabylonJS/Babylon.js/blob/master/src/LibDeclarations/webxr.d.ts. I don't think there is a way to automate that process using a js or ts libs, as this is a native browser API and nothing we compile ourselves. Having said that, if the webxr polyfill is updated to the current specs, it is possible to generate declaration file(s) for the polyfill and use it as webxr.d.ts.

    I will be happy to maintain the .d.ts file for webxr according to current specs

  3. added this to the Pre-REC milestone on Feb 3, 2020
  4. ManuelGraf commented on Mar 18, 2020

    @ManuelGraf

    add them at @types package https://www.npmjs.com/package/@types/npm
    but ideally, those should be part of immersive web package...

  5. added
    help wantedThis is a good issue for anyone to pick up and work on filing a PR for.
    on Aug 5, 2020
  6. fordacious commented on Sep 22, 2020

    @fordacious
    Contributor

    I happen to have a reasonably up to date one I whipped up for the webxr implementation on noclip.website. I'll look into adding it to the registry. Not sure how out of date it is.

  7. RaananW commented on Sep 29, 2020

    @RaananW

    We (babylonjs) will be distributing 4.2 with the following declaration file:

    https://github.com/BabylonJS/Babylon.js/blob/master/src/LibDeclarations/webxr.d.ts

    Does someone want to review it, or will it be helpful if I submit it somewhere (like @types/webxr)?

  8. Manishearth commented on Sep 29, 2020

    @Manishearth
    Contributor

    @RaananW If you can create a repo for the package (to be published as @types/webxr) and transfer it to immersive-web that would be great! We can move forward from there.

    I can do a more in depth review later, it looks mostly fine for now.

  9. RaananW commented on Oct 7, 2020

    @RaananW

    @Manishearth - I am preparing the repository right now. It seems however, that the fastest (and safest) way to get the typings to @types is to submit it to [DefinitelyTyped] (https://github.com/DefinitelyTyped/DefinitelyTyped) (As explained here). I will submit a PR there once I am done with a bit of cleanup and documentation.

  10. Manishearth commented on Oct 7, 2020

    @Manishearth
    Contributor

    That works, thanks!

  11. Manishearth commented on Oct 9, 2020

    @Manishearth
    Contributor

    @RaananW please CC me when you make a PR, I would like to review some of the stuff there

  12. RaananW commented on Oct 10, 2020

    @RaananW

    @Manishearth - of course. PR is coming Monday after i finished working on doc comments and a few cleanups.

  13. msub2 commented on Sep 8, 2021

    @msub2
    Contributor

    Is there anything to still be done here? It looks like the types were added a while ago and are pretty much up to date.
    https://www.npmjs.com/package/@types/webxr
    https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/webxr

  14. RaananW commented on Sep 8, 2021

    @RaananW

    The specs are constantly changing, there are a few things added and modified since the last update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedThis is a good issue for anyone to pick up and work on filing a PR for.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions