Skip to content
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

Open
NellWaliczek opened this issue Jan 21, 2020 · 12 comments
Open

Typescript definitions #953

NellWaliczek opened this issue Jan 21, 2020 · 12 comments
Labels
help wanted This is a good issue for anyone to pick up and work on filing a PR for.
Milestone

Comments

@NellWaliczek
Copy link
Member

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?

@klausw
Copy link
Contributor

klausw commented Jan 21, 2020

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?

@RaananW
Copy link

RaananW commented Jan 24, 2020

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

@toji toji added this to the Pre-REC milestone Feb 3, 2020
@ManuelGraf
Copy link

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

@Yonet Yonet added the help wanted This is a good issue for anyone to pick up and work on filing a PR for. label Aug 5, 2020
@fordacious
Copy link
Contributor

fordacious commented Sep 22, 2020

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.

@RaananW
Copy link

RaananW commented Sep 29, 2020

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)?

@Manishearth
Copy link
Contributor

Manishearth commented Sep 29, 2020

@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.

@RaananW
Copy link

RaananW commented Oct 7, 2020

@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.

@Manishearth
Copy link
Contributor

That works, thanks!

@Manishearth
Copy link
Contributor

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

@RaananW
Copy link

RaananW commented Oct 10, 2020

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

@msub2
Copy link
Contributor

msub2 commented Sep 8, 2021

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

@RaananW
Copy link

RaananW commented Sep 8, 2021

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
Labels
help wanted This is a good issue for anyone to pick up and work on filing a PR for.
Projects
None yet
Development

No branches or pull requests

9 participants