Skip to content

Commit 938c1dd

Browse files
committed
doc: update README.md for v2 and ESM
1 parent 2fc0206 commit 938c1dd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,24 @@ Turn on transpile-free type hinting for your vanilla JS projects #JSWithTypes
77
npm init
88
```
99
2. Turn on type linting 💪
10+
1011
```sh
1112
# Create a properly configured `jsconfig.json`
12-
npx jswt init
13+
npx -p jswt@2.x -- jswt init
14+
15+
# Install @types/node, if needed
16+
npm install --save '@types/node'
1317
```
18+
1419
3. Profit!
1520

1621
Works with **VS Code** out-of-the-box, and
1722
[Vim + ale](https://webinstall.dev/vim-essentials).
1823

24+
## CommonJS vs ESM
25+
26+
Use v1 for CommonJS, or v2 for ESM.
27+
1928
## Watch the Presentation!
2029

2130
[![JS with Types conference title slide](https://jswithtypes.com/assets/utahjs-conf-2022-jswt-title-yt.png)](https://jswithtypes.com/)
@@ -49,13 +58,14 @@ Your project will look something like this:
4958
npx -p typescript@5.x -- \
5059
tsc --init \
5160
--allowJs --alwaysStrict --checkJs \
52-
--moduleResolution node \
53-
--noEmit --noImplicitAny --target es2022 \
61+
--module nextnode --moduleResolution nextnode \
62+
--noEmit --noImplicitAny --target es2024 \
5463
--typeRoots './typings,./node_modules/@types'
5564
```
5665
2. Adds the following keys:
5766
```txt
58-
"include": ["*.js", "bin/**/*.js", "lib/**/*.js", "src/**/*.js"]`
67+
"paths": { "foo": ["./foo.js"], "foo/*": ["./*"] },
68+
"include": ["*.js", "bin/**/*.js", "lib/**/*.js", "src/**/*.js"]`,
5969
"exclude": ["node_modules"]
6070
```
6171
3. Renames `tsconfig.json` to `jsconfig.json` \

0 commit comments

Comments
 (0)