@@ -9,13 +9,17 @@ Turn on transpile-free type hinting for your vanilla JS projects #JSWithTypes
9
9
2 . Turn on type linting 💪
10
10
``` sh
11
11
# Create a properly configured `jsconfig.json`
12
- npx jswt init
12
+ npx -p jswt@2.x -- jswt init
13
13
```
14
14
3 . Profit!
15
15
16
16
Works with ** VS Code** out-of-the-box, and
17
17
[ Vim + ale] ( https://webinstall.dev/vim-essentials ) .
18
18
19
+ ## CommonJS vs ESM
20
+
21
+ Use v1 for CommonJS, or v2 for ESM.
22
+
19
23
## Watch the Presentation!
20
24
21
25
[ ![ JS with Types conference title slide] ( https://jswithtypes.com/assets/utahjs-conf-2022-jswt-title-yt.png )] ( https://jswithtypes.com/ )
@@ -49,13 +53,14 @@ Your project will look something like this:
49
53
npx -p typescript@5.x -- \
50
54
tsc --init \
51
55
--allowJs --alwaysStrict --checkJs \
52
- --moduleResolution node \
53
- --noEmit --noImplicitAny --target es2022 \
56
+ --module nextnode -- moduleResolution nextnode \
57
+ --noEmit --noImplicitAny --target es2024 \
54
58
--typeRoots ' ./typings,./node_modules/@types'
55
59
```
56
60
2 . Adds the following keys:
57
61
``` txt
58
- "include": ["*.js", "bin/**/*.js", "lib/**/*.js", "src/**/*.js"]`
62
+ "paths": { "foo": ["./foo.js"], "foo/*": ["./*"] },
63
+ "include": ["*.js", "bin/**/*.js", "lib/**/*.js", "src/**/*.js"]`,
59
64
"exclude": ["node_modules"]
60
65
```
61
66
3 . Renames ` tsconfig.json ` to ` jsconfig.json ` \
0 commit comments