question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript support

See original GitHub issue

I’m using Leaflet.GeometryUtil in a TypeScript project. As far as I’m aware, there are no typings yet, as mentioned in #73.

I would like to write some typings. There are 3 options:

  1. Write typings and publish them as a separate @types/leaflet-geometryutil package.
  2. Write typings and include them in this repository. This would involve creating a .d.ts definition file and referencing it in the "types" field in package.json.
  3. Convert the whole source code to TypeScript. This would involve changing the setup a bit. A build script would have to be run before publishing the project.

The first option is the least intrusive to this project, the third one is the most proper one, since it makes sure that the type definitions are really in sync with the code.

Which one would you prefer?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
IlyaDiallocommented, Feb 4, 2021

I tend to prefer TS as well (let’s be honest, I deeply hate JS), but I’m not a maintainer of this package yet I’m a colleague of them. Converting everything is a risk to create new bugs, and let’s be pragmatic, just adding the typings would be the easiest solution. Converting to TS is a language and paradigm change, for the whole package, thus all package maintainers must agree altogether to do such a breaking change.

Now the debate is opened. But let’s start small and easy. This wouldn’t disallow to switch to TS later, but this need to be evaluated with everyone first.

The JS vs TS debate is a bit like the C vs C++ debate. It’s pointless without context - JS is better for some projects, TS is better for others. I’d like to point out that this project is a plugin for a JS library itself included in JS applications. So having to “compile” from TS to use it, or (more importantly) having to know TS to contribute to it would be a huge drawback. TS coders are supposed to be familiar with JS but not the other way around.

2reactions
cdauthcommented, Feb 4, 2021

That makes sense.

Also, once the typings are there, it’s less work to convert the existing code to TypeScript.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript: JavaScript With Syntax For Types.
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes ...
Read more >
TypeScript - Wikipedia
TypeScript supports definition files that can contain type information of existing JavaScript libraries, much like C++ header files can describe the ...
Read more >
TypeScript Programming with Visual Studio Code
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It offers classes, modules, and interfaces to help you build robust...
Read more >
TypeScript | WebStorm Documentation - JetBrains
WebStorm supports developing, running, and debugging TypeScript source code. ... Learn more from Compiling TypeScript into JavaScript.
Read more >
TypeScript support in Svelte - Learn web development
First-class TypeScript support has been Svelte's most requested feature for quite some time. Thanks to the hard work of the Svelte team, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found