-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Compiler API - ts.ModuleKind
and ts.ScriptTarget
is undefined
#56903
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
Comments
ts.ModuleKind
is undefined
ts.ModuleKind
and ts.ScriptTarget
is undefined
Ok, I replaced
so I thought there is something wrong with my import statemenet import ts from "typescript"
// earlier was: import * as ts ... and it worked, but still in Compiler API Wiki example it used |
The is a duplicate of #56366. That code only works when in a TS file such that import helpers are in use. In native ESM in Node, you must write: import ts from "typescript"; At some point, a namespace import used to cause Node to throw, but that is no longer true and I'm not sure why. Potentially we could update the wiki to use the default import for safety as that should work elsewhere. |
it didn't work in the typescript file either |
Do you have esModuleInterop enabled? |
Oh yeah I do |
🔎 Search Terms
I tried search searching on the internet for
but found nothing that could help me :(
but i found this issue - #26535
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about
⏯ Playground Link
No response
💻 Code
This is the same code as given in the example of Typescript compiler api
🙁 Actual behavior
An error occurred, saying that
ts.Modulekind
isundefined
🙂 Expected behavior
The
result
should've been printedAdditional information about the issue
No response
The text was updated successfully, but these errors were encountered: