Types/add generics to remaining node types
Ahh, I see where you want to go. Makes sense. Thanks for starting this PR 👍
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 :-)
Thanks Matt, this looks good. Two small feedbacks:
-
The
build-and-testscript 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. -
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))?
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/**)?
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 :)
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?
Definitely! I'll merge this PR now and will publish it tomorrow.
Published now in v11.3.2