Definitelytyped: [@types/d3-array] Please update to latest version v2.0.3

Created on 15 Jan 2019  路  12Comments  路  Source: DefinitelyTyped/DefinitelyTyped

Hello,

D3-array has been updated to major version release v2.0.0. I am using this in typescript based lib

Typescript Version - v3.2.2
Node Version - v8.11.2

If you know how to fix the issue, make a pull request instead.

  • [x] I tried using the @types/d3-array package and had problems.
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @gustavderdrache , @borisyankov , @tomwanzek , @denisname

If you do not mention the authors the issue will be ignored.

Most helpful comment

Thanks for the effort!

I think there is a need to resync all versions of all modules with the existing ones, including the global d3 types bundle. I'll try taking care of that shortly, so that we can try and see where we stand and how to move

All 12 comments

Thanks for reporting this, I will try tackling it in the upcoming days (not a promise, but will try my best)

I am using "d3-array": "^2.2.0",, can the types be updated please? Getting errors, for instance, the function groups is missing from the types.

cc: @gustavderdrache, @borislavjivkov, @tomwanzek, @denisname, @ledragon

Hi,
Thanks for reporting this. There is actually a lot of work to update all d3 modules to their latest versions... And I am not sure as to how much time any of us can devote to this currently (you might have noticed that not much has been done recently). Feel free to submit a PR to update the types. I can try fitting this one in my schedule, but cannot promise anything...

@Ledragon Thanks for the prompt response. Can you please share the steps to generate type definition from the source files? Will be useful for creating PRs for other devs, if you're not able to update the definitions by yourself.

Actually slower on the second reply :-)
Not sure I have "steps" to provide. The way I tend to do these is by reading the documentation, adding the definitions in the types, and adding associated tests. I never personally used the original source to extract definitions automatically. I go read the original code when I am unsure about the types of the parameters or the like.

Any updates here? Are we really the only 4 people in the world using d3-array in typescript?

Sorry, time is tight, and as I don't use v5 much these days, this has become a lesser priority... But this stays on my mind still

That would be real good @Ledragon and @gustavderdrache , @borisyankov , @tomwanzek , @denisname.
I find the d3 data-churning functions so clean and efficient; very handy for keeping code clean and fast.
We now have type definitions for all the functions, but none seem to account for spread arguments (for example using two keys with rollup will throw an error saying that only 3 arguments were expected.
I have tried to change/play with the type definitions in d3-array/index.d.ts but it is unfortunately beyond my skill level...
Here is where I initially posted the problem:
https://community.powerbi.com/t5/Custom-Visuals-Development/Problem-using-quot-d3-array-quot-rollup-and-it-spread-argument/m-p/924994/highlight/false#M2968

@Schizzomarino, @chriszrc Would you guys be able to help with providing the test cases (in d3-array-tests.ts) for the latest d3-array v2.4.0 version? I have started updating to 2.4.0 compatible definitions on a separate fork (will be a very big task to contribute definitions for all the missing versions, so focussing on the latest one only). Apart from factoring in the spread arguments in some places, some functions are also missing from the current type definitions:

  1. Statistics
  2. [x] minIndex
  3. [x] maxIndex
  4. [x] cumsum
  5. [x] quantileSorted

  6. Search

  7. [x] least
  8. [x] leastIndex (scan is deprecated)
  9. [x] greatest
  10. [x] greatestIndex
  11. [ ] ~bisect (same as bisectRight)~ Was already there

  12. Transformations

  13. [x] groups (group is also adapted to accept multiple keys)
  14. [x] rollups (rollup is also adapted to accept multiple keys)
  15. [x] count

  16. Bins

  17. [ ] bin (histogram is deprecated)

  • The typings for the checked ones are included so far in that fork, but they are currently missing test cases.
  • Will now target to update the remaining functions from above in the next few days. Not a priority for me too currently, so pushing code only when I can find the time.
  • Was hoping that if some of us users can split certain tasks like writing test cases, checking what needs to be updated, updating the typings, etc., we might be able to pull it more quickly.
  • Following @Ledragon's suggestion and comparing the missing definitions with existing ones seems to be quite effective so far.

Thanks for the effort!

I think there is a need to resync all versions of all modules with the existing ones, including the global d3 types bundle. I'll try taking care of that shortly, so that we can try and see where we stand and how to move

@maneetgoyal Update of all d3 types is monitored in #38939; I would suggest to close this and track everything there, if ok for you

That鈥檚 great @Ledragon. Tagging the OP @piyushgupta1 regarding your suggestion.

Was this page helpful?
0 / 5 - 0 ratings