Skip to content
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

Convert tests to Typescript, change require to import, and add named exports to modules #2550

Merged
merged 10 commits into from
Dec 5, 2023

Conversation

smallsaucepan
Copy link
Member

Converting all bench.js and test.js tests over to Typescript. In most cases this involved only renaming and converting require() to import(). There are still a lot of type warnings highlighted in IDEs, though they don't affect running the tests or the main build. Fixing all these type errors at once would be a mammoth task, so better to update as we go.

Replaced require() with import() in almost all cases within the module codespace. There are a few requires() left in utility scripts which can be addressed in a subsequent PR.

Added named exports for all modules. Eventually(?) default exports should be a thing of the past so laying the groundwork for that.

Both the import() and named exports work is in preparation for looking at rejigging the ESM / CJS approach used by the project.

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Have read How To Contribute.
  • Run npm test at the sub modules where changes have occurred.
  • Run npm run lint to ensure code style at the turf module level.

…angle as a named export as well as the default.
…area as a named export as well as the default.
…ing named exports as well as the default export for modules:

bbox
bboxCliip
bboxPolygon
bearing
bezierSpline
booleanClockwise
booleanConcave
booleanContains
booleanCrosses
booleanDisjoint
booleanEqual
booleanIntersect
booleanOverlap
booleanParallel
booleanPointInPolygon
booleanPointOnLine
booleanTouches
booleanValid
booleanWithin
…ining Typescript modules. Also adding named exports in addition to the default export for those same modules.
…to do - waiting for PR Turfjs#2543 to merge first to avoid conflicts.
… more Typescript modules (postponed until recent PRs merged). Also adding named exports in addition to the default export for those same modules.
…address probably fixed by a previous typescript upgrade. Removing redundant es5 checking script that hasn't been used for a while as well.
Copy link
Collaborator

@twelch twelch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate the progress

@smallsaucepan smallsaucepan merged commit d83e580 into Turfjs:master Dec 5, 2023
3 checks passed
Copy link
Collaborator

@mfedderly mfedderly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peeked at the first 50 or so files and this approach looks awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants