Giter VIP home page Giter VIP logo

Comments (13)

create3000 avatar create3000 commented on September 27, 2024

#116

from x_ite.

create3000 avatar create3000 commented on September 27, 2024

I'm not that familiar with TypeScript, which means I can't maintain the declarations file either, which means a PR is always welcome.

from x_ite.

create3000 avatar create3000 commented on September 27, 2024

I have already had a look at the .ts file, there are still a few small errors in there, but on the whole it already looks very good.

from x_ite.

create3000 avatar create3000 commented on September 27, 2024

I put the .d.ts file in the dist folder https://github.com/create3000/x_ite/tree/development/dist. I hope this is the right place. Could you please give me an example how I can benefit from this file.

from x_ite.

gwhitney avatar gwhitney commented on September 27, 2024

Well the problem is I am no expert on creating .d.ts files for javascript projects, either. When you make a native TypeScript project, it just generates the .d.ts for you.

But I think that you have put the .d.ts file in the best place, right alongside the module file. And when it is there, one then can/should unwrap it from the declare module URL { ... } block and move everything inside up one level. Also I think the line const X3D : X3D should actually be declare const X3D : X3D.

I think with those changes if it is published this way on npm and imported into a typescript project, then one can import X3D from 'x_ite' and start calling the functions and they will just typecheck properly. I will make a dummy TypeScript project and install the current x_ite and just put the file modified in this way by hand alongside the module file in node_modules and see if it works and let you know.

from x_ite.

gwhitney avatar gwhitney commented on September 27, 2024

Yes, indeed, that worked, with the one additional change that I had to add a declare before class X3DField. The exact file I added in dist is attached to this message, to avoid ambiguity.

So if you ship this file alongside the x_ite JavaScript files, then it should be usable directly from TypeScript, and intellisense should work (although I don't use an IDE, so I can't vouch for that completely). I would recommend it in the next release. Let me know if there is more I can do to help. (And of course, yes, I am sure some improvements to this .d.ts will be needed over time, but I hope it is an OK place to start.)
x_ite.d.ts.txt

from x_ite.

create3000 avatar create3000 commented on September 27, 2024

I have tested the new file with VSCode and IntelliSense works fine for both JS and TS files. Thanks for your great efforts. If you have further updates, please let me know.

from x_ite.

gwhitney avatar gwhitney commented on September 27, 2024

Well once it's in an x_ite published release, then thereafter I can just file PRs to this repository with any corrections/improvements that I may find. Thanks!

from x_ite.

create3000 avatar create3000 commented on September 27, 2024

I can make a release next Sunday if all is fine, and we have still time for changes.

from x_ite.

gwhitney avatar gwhitney commented on September 27, 2024

OK, I have updated my project to use the .d.ts directly from the develop branch, and it is working OK at the moment. If I discover anything that seems to need a change, I will just file a PR against that branch. Once it's published, I will switch to using it from the main branch, or just grab it from the CDN if it ends up on there too (not sure if it will).

from x_ite.

create3000 avatar create3000 commented on September 27, 2024

I have added you to the list of contributors in https://github.com/create3000/x_ite/blob/development/package.json, for that reason it is good idea to make a PR when the file has changed, because GitHub automatically keeps track of it.

from x_ite.

create3000 avatar create3000 commented on September 27, 2024

Version 8.12.1 is out now. Please drop me a note if it is working for you.

from x_ite.

gwhitney avatar gwhitney commented on September 27, 2024

Oh dear, seems I overlooked responding -- yes, I am compiling and running fine with the latest version, now 8.12.4. Thanks!

from x_ite.

Related Issues (20)

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.