Git Product home page Git Product logo

Comments (10)

chrisveness avatar chrisveness commented on August 24, 2024

I have no experience with TypeScript at all.

Could you point me to some resource which explains the function of index.d.ts? (I wouldn't want to offer something – and end up supporting something – I don't understand!).

from geodesy.

DenisCarriere avatar DenisCarriere commented on August 24, 2024

I would recommend reading Microsoft's docs, https://www.typescriptlang.org

In a nut shell, typescript allows types in JavaScript, it makes it a lot easier to troubleshoot a library if you can catch errors before you compile or run in the browser.

from geodesy.

chrisveness avatar chrisveness commented on August 24, 2024

Yes, I'm familiar with the overall idea of TypeScript, but I don't know the function of index.d.ts.

Within that site, I can find several times index.d.ts is mentioned (eg Module Resolution, sample module.d.ts), but not an explanation of what it does or what it is for.

Can you direct my to something more specific?

from geodesy.

chrisveness avatar chrisveness commented on August 24, 2024

I've had a look at the index.d.ts in the fork you've taken. It looks rather analogous to a Java interface?

You might be interested that I am working on a revised version of the library (using ES-modules), which splits the core ellipsoidal functions (used inter alia by mapping functions) from the datum conversions, and adds modern epoch-based TRS conversions to complement the (now mostly historical) datum conversions. It also separates the vector-based geodetic code into spherical and ellipsoidal parts.

Of course, this all adds more complexity to the interdependencies, so I don't plan to release this using ES5 syntax, and plan to wait until there is at least one native ES-modules implementation available (I'm tracking Chrome, Firefox, Edge, and Node developments closely!).

All of which to say I'm hoping this version of the library will be history before too very long. I think the ES-modules spec has been fairly closely tracked by TypeScript developments? So I would be much more interested in whatever is required to build an interface between that new version and TypeScript than to mess around with the current version...

from geodesy.

DenisCarriere avatar DenisCarriere commented on August 24, 2024

Well treat this index.d.ts as a patch to your current package, it allows your ES5 library to be compatible with Typescript.

Typically I pushed my Typescript definition to DefinitelyTyped which publishes thousands of high quality Typescript definitions, the only draw back is now you have to install two libraries (ex: npm install geodesy & npm install @types/geodesy).

Since you are active on your project, I figured it's better to have the Typescript definition embedded in your library that way you can control the changes when new features become available.

You might be interested that I am working on a revised version of the library (using ES-modules), which splits the core ellipsoidal functions (used inter alia by mapping functions) from the datum conversions, and adds modern epoch-based TRS conversions to complement the (now mostly historical) datum conversions. It also separates the vector-based geodetic code into spherical and ellipsoidal parts.

Awesome stuff! Looking forward to the revised version, I would recommend you build on top of the latest ES6/ES7 and use tools like Babel or Typescript to compile down to your preferred version.

For your extra added complexity, you should follow the code philosophy of TurfJS, they are using Lerna to package each dependency as an independent testable module, this makes it a lot easier to build a large scale mutli package library and have it fully tested.

from geodesy.

juliocbcotta avatar juliocbcotta commented on August 24, 2024

So... to have the type definitions... what is the current approach?

from geodesy.

DiefBell avatar DiefBell commented on August 24, 2024

@DenisCarriere Do you have a version that supports version 2.2.0 of this library please? I think this is what's causing issues for me updating the library in my React-Native code.

from geodesy.

chrisveness avatar chrisveness commented on August 24, 2024

@DenisCarriere if you have an index.t.ds which matches the current v2.2.0 interface, I would gladly accept a PR.

from geodesy.

JonghunYu avatar JonghunYu commented on August 24, 2024

Hi @chrisveness
I just created a new PR for this. Please take a look.

#70

from geodesy.

chrisveness avatar chrisveness commented on August 24, 2024

Type definitions for geodesy v2 are now available from www.npmjs.com/package/@types/geodesy.

Thx, Jonghun Yu.

from geodesy.

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.