mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

Fix the `simplifyCore` fix

Open joshhansen opened this issue 4 years ago • 3 comments

In #2456 I failed to introduce simplifyCore typing to MathJsStatic (it was only added to MathJsChain). This PR fixes that omission. It also changes the return type of the MathJsChain form of simplifyCore to be MathJsChain which is the convention in that environment.

joshhansen avatar Mar 08 '22 01:03 joshhansen

Thanks Josh 👍

I think the definition of the chain method must be:

simplifyCore(): MathJsChain;

since the expr is already in the chain object. Usage is like:

const expr = '2 + 3'
math.chain(expr)
  .parse()
  .simplifyCore()
  .done()
  .toString() // 5

josdejong avatar Mar 08 '22 14:03 josdejong

And now that we have testing of the TypeScript typing by way of running types/index.ts, please could you add code to the latter file which will verify that math.simplifyCore is correctly typed? Thanks!

gwhitney avatar Mar 08 '22 22:03 gwhitney

I am willing to make the small tweaks it would take to get this mergeable.

gwhitney avatar Aug 17 '22 09:08 gwhitney