-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fixed typo in Modules.md #2580
Fixed typo in Modules.md #2580
Conversation
The example tried to import `hello.js` from `hello.ts`. This page is missing sections on `package.json` and `tsconfig.json`. If you have these misconfigured then your modules won't work. Please add sections explaining what's needed. I'm not an expert on this, all I know is that `package.json` needs to have `"type": "module",` and `tsconfig.json` needs to have `"module": "ESNext",` and `"target": "ESNext"`. I'll start two sections at the bottom of the page, please complete these sections.
@microsoft-github-policy-service agree |
1 similar comment
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think it's likely that we are completely overhauling this doc soon.
@@ -72,7 +72,7 @@ export default function helloWorld() { | |||
} | |||
// @filename: index.ts | |||
// ---cut--- | |||
import helloWorld from "./hello.js"; | |||
import helloWorld from "./hello.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely do not want to be sticking .ts
imports into our examples.
|
||
## package.json | ||
|
||
To use modules your `package.json` must include `"type": "module",`. For example, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to be covered by https://www.typescriptlang.org/docs/handbook/esm-node.html, right? Maybe we just need links if we don't have them already?
Thank you for the effort, but this topic really can’t be wedged into this page as-is. It’s going to require a total rewrite, which is in progress at microsoft/TypeScript#52593. |
The example tried to import
hello.js
fromhello.ts
.This page is missing sections on
package.json
andtsconfig.json
. If you have these misconfigured then your modules won't work. Please add sections explaining what's needed. I'm not an expert on this, all I know is thatpackage.json
needs to have"type": "module",
andtsconfig.json
needs to have"module": "ESNext",
and"target": "ESNext"
. I'll start two sections at the bottom of the page, please complete these sections.