Update of Typescript Types
- Dominant language
- JavaScript
- Stars
- 279
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Hey and thank you for this library, i was also reading "Computation Geometry, Algorithms and Applications" and i was very confused by the type of tree they used there (with information only on the leaf nodes) and how to implement these algorithms with the normal tree (which is from what i can tell has been done here in the case of bentley-ottmann, but please correct me)
so this implementation has helped me alot !
Through usage i have noticed that the TS types could be improved;
I have posted below the declarations i am using locally, i have
1. added types for options
2. added types for individual functions in the format that they are exported
3. i have added a generic param as i have noticed you can add your own metadata to the objects and get this served back to you in the results which i found useful. However i may be levaraging something i am not meant to here.
If its agreeable i will open a pr, just thought i would get some initial thoughts before i did this
Thanks again !
```typescript
export type Position = {
x: number;
y: number;
};
export type OutputSegment = {
dy: number;
dx: number;
angle: number;
} & InputSegment;
export type OutputIntersection = {
point: Position;
segments: Array>;
};
export type MetaBase = Record;
export type InputSegment = {
from: Position;
to: Position;
} & SEGMENT_META;
export type FunctionResult = {
run: () => Array>;
};
export type Options = {
onError?: () => void;
onFound?: (intersection: OutputIntersection) => void;
};
export function sweep(
segments: Array>,
opt?: Options,
): FunctionResult;
export function brute(
segments: Array>,
opt?: Options,
): FunctionResult;
export function bush(
segments: Array>,
opt?: Options,
): FunctionResult;
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the library's exported sweep, brute, and bush entry points and locate the current TypeScript declarations. Compare them with the proposed Position, segment, intersection, options, and generic metadata types. Done means the public declarations accurately describe these functions and preserve metadata through their results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100