-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript: meriyah package is not compatible with estree package #199
Comments
I am also using forced type conversion to tap into various estree tools. import {parseScript, Options} from 'meriyah';
import * as ESTree from 'estree';
const paserOptions: Options = {
next: true,
ranges: true,
loc: true,
webcompat: true,
globalReturn: true,
impliedStrict: true
};
export default function (code: string): ESTree.Program {
return parseScript(code, paserOptions) as ESTree.Program;
} It's possible to refactor meriyah code to use estree types (that will introduce a dependency which we don't like), but needs quite some work. The types defined in meriyah didn't strictly follow estree, especially the inheritance of estree types. The generated data structure conforms to estree, but our type definitions might have some differences (I cannot recall some details). Sorry, I (the only active maintainer right now) don't have plan to work on this in near future. |
Hello,
Just trying to use 'meriyah' (4.2.0) with 'estree-toolkit' (1.2.6) and '@types/estree' (0.0.50), so latest available versions, with TypeScript compiler. I just found that Meriyah NPM package is not compatible with '@types/estree' NPM package.
When I do:
the type checker reports the error:
So basically, the Program type returned by parseModule is not inferred from Program declared in the @types/estree.
Although I can go around it (and it seems working correctly in runtime) by:
It would be great if this works out of the box. Is it possible to use same types?
The text was updated successfully, but these errors were encountered: