New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript definitions #953
Comments
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? |
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 |
add them at @types package https://www.npmjs.com/package/@types/npm |
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. |
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)? |
@RaananW If you can create a repo for the package (to be published as I can do a more in depth review later, it looks mostly fine for now. |
@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. |
That works, thanks! |
@RaananW please CC me when you make a PR, I would like to review some of the stuff there |
@Manishearth - of course. PR is coming Monday after i finished working on doc comments and a few cleanups. |
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. |
The specs are constantly changing, there are a few things added and modified since the last update |
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?
The text was updated successfully, but these errors were encountered: