Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Fixed typo in Modules.md #2580

wants to merge 1 commit into from

Conversation

tdkehoe
Copy link

@tdkehoe tdkehoe commented Oct 24, 2022

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.

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.
@tdkehoe
Copy link
Author

tdkehoe commented Oct 24, 2022

@microsoft-github-policy-service agree

1 similar comment
@tdkehoe
Copy link
Author

tdkehoe commented Oct 24, 2022

@microsoft-github-policy-service agree

Copy link
Member

@jakebailey jakebailey left a 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";
Copy link
Member

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,
Copy link
Member

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?

@andrewbranch
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants