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

TypeScript declarations! #1320

Merged
merged 49 commits into from
Mar 13, 2023
Merged

TypeScript declarations! #1320

merged 49 commits into from
Mar 13, 2023

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Mar 8, 2023

TODO

  • Complete TypeScript declarations for public APIs
  • Port snapshot tests to TypeScript (to test TypeScript declarations)
  • Enable ESLint on TypeScript declarations
  • Enable strictNullChecks?
  • Re-enable yarn test:tsc

Possible future enhancements:

  • Documentation for all TypeScript declarations
  • Consolidate test data loading logic so that it can be type-safe across tests

@dennismphil
Copy link

Absolute lifesaver. Thank you!! 

I have been maintaining these manually the ones I use and it is quite a lot of work.

src/plot.d.ts Outdated Show resolved Hide resolved
src/mark.d.ts Outdated Show resolved Hide resolved
@mbostock mbostock marked this pull request as ready for review March 13, 2023 02:59
@mbostock mbostock requested review from duaneatat and Fil March 13, 2023 03:00
@mbostock
Copy link
Member Author

There is a lot more work to do regarding documentation here (probably dozens of hours). But the types here should be ready to review, and I think we probably shouldn’t block this PR on finishing the documentation—just on the types themselves.

Copy link
Contributor

@Fil Fil left a comment

Choose a reason for hiding this comment

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

Awesome work! Can't wait to start adding jsdoc everywhere.

And a medal for removing 500+ lines (+3,300 −3,841) 🏅

Copy link
Contributor

@duaneatat duaneatat left a comment

Choose a reason for hiding this comment

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

This is great, so nice to finally have a working full-breadth implementation!

src/reducer.d.ts Outdated Show resolved Hide resolved
src/transforms/bin.js Show resolved Hide resolved
src/transforms/group.js Show resolved Hide resolved
src/transforms/window.d.ts Outdated Show resolved Hide resolved
@mbostock mbostock merged commit 6b87468 into main Mar 13, 2023
@mbostock mbostock deleted the mbostock/typescript branch March 13, 2023 17:01
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
* remove typescript machinery

* checkpoint typescript declarations

* restore mocha and eslint for typescript

* tweak package.json

* port tests to TypeScript

* fix plural inconsistency

* more better types

* allow empty interfaces, for now

* fix plural test

* remove jsdoc annotations

* fix test names, again

* export all types

* remove build

* more better types

* add missing exports

* RenderFunction, strict

* more better types

* more better transform types

* more better types

* more better types

* still more better types

* quantize, quantile scale options

* nullish markish

* more better types

* even more better types

* avoid name conflicts with types

* still more better types

* unstrict

* allow cased color scheme names

* more better types

* more documentation; ScaleDefaults

* turn off data type checking

* fix remaining TypeScript errors; enable tsc

* auto types

* stricter lint

* better line, area options, and more

* more documentation

* linearRegression[XY] dense interval

* stricter percentile

* better bar, rect intervals

* more percentiles

* more interval types

* tree, valueof, column

* style, className

* comment re. omit interval

* autocomplete stack order

* z for stack, map, select
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.

None yet

4 participants