-
Notifications
You must be signed in to change notification settings - Fork 949
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 #515
Comments
@tmcw @morganherlocker Good news! With the latest update After this is done... Implementing this for {
"name": "test",
"main": "index.js",
"dependencies": {
"@turf/helpers": "^3.6.1"
}
} |
🚀🚀 Woot! Completed all the Typescript definitions
|
Nice work! |
Thanks! Should be good to publish to npm, test it out before, but so far the typescript definitions are working in my environment. |
@morganherlocker @tmcw Just published a new version to npm One minor hiccup is I forgot to include I hope you don't mind me pushing another release in the same day to |
Hey, I don't see anymore index.d.ts for the centroid package. Is this a missing ? Thanks |
Seems to be missing for @turf/distance as well. |
How are we supposed to use types? I have the following, but WebStorm/IntelliJ doesn't automatically see these types (why?) so I wonder if I'm doing something wrong.
|
Try removing |
Any news on this? Just installed @turf/centroid 6.0.1 and types are missing… |
It is also missing from @turf/center-of-mass package |
I came around this, by importing this:
and then use it with
|
If you use 6.2.0-alpha.3 the types and versions are all consistent. I'm working on getting 6.2.0 stable but its definitely worth checking out if you want tree shaking, consistent package dependencies, and typescript definitions. |
ok. thanks. Do you have a rough estimate on a stable release ETA? |
I'm hoping to maybe get it done by end of year but the timeline is not completely set. 6.2.0-alpha.3 should be usable if you give it a try and test it a little bit. I have been using -alpha2 successfully for a few months. |
Problem
At the moment you can install Typescript 2.0 definitions via
npm install @types/turf
.However, not all of the definitions are defined and it can be overwhelming trying to manage a 1280+ LOC type definition.
Solution
I'm suggesting we host the Typescript type definitions within the Turf library instead of DefinitelyTyped.
By including a simple & minimalistic
index.d.ts
andtest/types.ts
within each package, the type definitions will be bundled with each namespace package.By default
index.d.ts
will be automatically detected, however including"types": "index.d.ts"
in thepackage.json
is a good practice.To-Do
turf-along
turf-area
turf-bbox
turf-bbox-polygon
turf-bearing
turf-bezier
turf-buffer
turf-center
turf-center-of-mass
turf-centroid
turf-circle
turf-collect
turf-combine
turf-concave
turf-convex
turf-destination
turf-difference
turf-distance
turf-envelope
turf-explode
turf-flip
turf-helpers
turf-hex-grid
turf-idw
turf-inside
turf-intersect
turf-invariant
turf-isolines
turf-kinks
turf-line-distance
turf-line-slice
turf-line-slice-along
turf-meta
turf-midpoint
turf-nearest
turf-planepoint
turf-point-grid
turf-point-on-line
turf-point-on-surface
turf-random
turf-sample
turf-simplify
turf-square
turf-square-grid
turf-tag
turf-tesselate
turf-tin
turf-triangle-grid
turf-union
turf-within
The text was updated successfully, but these errors were encountered: