segmentEach callback args typed as nullable
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
The TypeScript types for segmentEach in @turf/meta have all the arguments to the callback as nullable, but it doesn't appear from either the docs or the code that they can ever be null. This makes it necessary to write pointless checks for undefined to get my code to typecheck.
Using Turf 7.1.0; this is still the case in latest master.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at packages/turf-meta/index.d.ts#L228 and read the segmentEach type alongside the linked implementation and documentation. Confirm whether the callback arguments can be null, then update the type declaration so it matches the observed API and verify that TypeScript consumers no longer need unnecessary undefined checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100