mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

Types/add generics to remaining node types

Open mattvague opened this issue 3 years ago • 2 comments

mattvague avatar Aug 30 '22 16:08 mattvague

Ahh, I see where you want to go. Makes sense. Thanks for starting this PR 👍

josdejong avatar Sep 02 '22 14:09 josdejong

Ahh, I see where you want to go. Makes sense. Thanks for starting this PR 👍

Yeah we've found having generics on OperatorNode extremely useful so far and would like to extend that to everything else. I believe @isaacbyr is going to be finishing this one off for us :-)

mattvague avatar Sep 02 '22 17:09 mattvague

Thanks Matt, this looks good. Two small feedbacks:

  1. The build-and-test script fails with errors (see https://github.com/josdejong/mathjs/actions/runs/3092630770/jobs/5004119664). Can you look into that?

    Error: index.ts(985,5): error TS2554: Expected 1 arguments, but got 0.
    Error: index.ts(1804,5): error TS2554: Expected 1 arguments, but got 0.
    Error: index.ts(1806,50): error TS2554: Expected 1 arguments, but got 0.
    Error: index.ts(1812,5): error TS2554: Expected 1 arguments, but got 0.
    Error: index.ts(1818,5): error TS2554: Expected 1 arguments, but got 0.
    Error: index.ts(1824,5): error TS2554: Expected 1 arguments, but got 0.
    Error: index.ts(1830,5): error TS2554: Expected 1 arguments, but got 0.
    Error: index.ts(2294,27): error TS2554: Expected 1 arguments, but got 0.
    Error: Process completed with exit code 2.
    
  2. How can we verify that the generics work as intended? Can we add a few usage examples in index.ts? (Or is that already covered by fixing (1))?

josdejong avatar Sep 23 '22 13:09 josdejong

How can we verify that the generics work as intended? Can we add a few usage examples in index.ts? (Or is that already covered by fixing (1))?

@josdejong I was thinking that the existing examples would probably cover most types but we could probably beef it up a bit. To be honest I guess I also had a bit of a mental block about doing this given how huge index.ts is becoming and how I'd have to make a lot of decisions like "where in this file would these kinds of tests go". I wonder if we want to take this opportunity to start splitting this into smaller files (e.g. one-to-one with the files in src/expression/node/**)?

mattvague avatar Oct 04 '22 18:10 mattvague

Yes good idea to start splitting the index.ts file!

If you're in the mood for it you could make a small in this PR, but please keep it small, I would love to merge this PR soon and not have an endlessly growing PR :)

josdejong avatar Oct 05 '22 08:10 josdejong

Yes good idea to start splitting the index.ts file!

If you're in the mood for it you could make a small in this PR, but please keep it small, I would love to merge this PR soon and not have an endlessly growing PR :)

@josdejong Don't think I have the time right now to properly, fully test this. I also kind of think that our existing tests should be sufficient to at least ensure that nothing breaks. Could we merge this and come up with a more comprehensive test plan later?

mattvague avatar Oct 19 '22 19:10 mattvague

Definitely! I'll merge this PR now and will publish it tomorrow.

josdejong avatar Oct 20 '22 07:10 josdejong

Published now in v11.3.2

josdejong avatar Oct 25 '22 08:10 josdejong