@@ -7,15 +7,24 @@ Turn on transpile-free type hinting for your vanilla JS projects #JSWithTypes
77 npm init
88 ```
992 . 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+
14193 . Profit!
1520
1621Works 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 ```
56652 . 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 ```
61713 . Renames ` tsconfig.json ` to ` jsconfig.json ` \
0 commit comments