expr-eval icon indicating copy to clipboard operation
expr-eval copied to clipboard

Cannot find module

Open ghost opened this issue 5 years ago • 2 comments

import {Parser} from 'expr-eval'

const res = Parser.evaluate('3+2 * 5 ** power', {
    power: 2
})

console.log(res)

I've trying to implement expr-eval into my project today, which is written with Typescript. Then I encounter this problem. Maybe it's some problem with parser.d.ts ? Sorry I'm a newbie in coding. Thx very much for any helps! e120f93111291fd11173f48a947eac7

ghost avatar Mar 30 '20 07:03 ghost

For some reasons, it works with require instead of import {...} from '...', but with the price of loosing all the juicy code hinting and stuff. Maybe I can try write with import and switch to require when compile, but then again it's possible to loose all the juicy type assertion Typescript provides when type error occurs.

ghost avatar Mar 30 '20 16:03 ghost

Unfortunately I have almost no experience with TypeScript. It's something I'm interested in learning more about but haven't gotten to it yet. I'll try to play around with it when I get a chance and see if I can figure it out, but I won't be much help until then.

silentmatt avatar Apr 03 '20 20:04 silentmatt