-
Hello, I found: https://www.npmjs.com/package/oxc-parser It works well to parse JS files, but it is giving me errors with TS files. Is this expected? It seems the rust parser (https://github.com/oxc-project/oxc/blob/main/crates/oxc_parser/examples/parser.rs) works fine with TS files, so I was expecting the NPM parser to work well too. |
Beta Was this translation helpful? Give feedback.
Answered by
Sleepful
Apr 27, 2024
Replies: 1 comment 4 replies
-
Try passing in the filename with the correct extension, i.e. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Boshen oh, you are right. I see what you mean now.
This works fine:
Now that I remember, I had looked at https://github.com/oxc-project/oxc/blob/main/napi/parser/index.d.ts#L82 before posting this discussion, but I was looking for something like "filetype" that I could tell it "TypeScript". It didn't occur to me that
sourceFilename
was important! Adding a sample in the README for the NPM package wheresourceFilename
is used for a TS file would have been enough.