Skip to content

Commit 0b98c23

Browse files
committed
init typescript
1 parent 380ab07 commit 0b98c23

File tree

5 files changed

+62
-1
lines changed

5 files changed

+62
-1
lines changed

babel.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ module.exports = function(api) {
3434
modules: false,
3535
exclude: ['transform-typeof-symbol']
3636
}
37-
]
37+
],
38+
['@babel/preset-typescript', { 'allExtensions': true, 'isTSX': true }]
3839
].filter(Boolean),
3940
plugins: [
4041
'babel-plugin-macros',

config/webpacker.yml

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ default: &default
3333
- .woff2
3434

3535
extensions:
36+
- .tsx
37+
- .ts
3638
- .mjs
3739
- .js
3840
- .sass

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
"name": "books",
33
"private": true,
44
"dependencies": {
5+
"@babel/preset-typescript": "^7.16.7",
56
"@rails/actioncable": "^6.0.0",
67
"@rails/activestorage": "^6.0.0",
78
"@rails/ujs": "^6.0.0",
89
"@rails/webpacker": "5.4.3",
910
"turbolinks": "^5.2.0",
11+
"typescript": "^4.5.5",
1012
"webpack": "^4.46.0",
1113
"webpack-cli": "^3.3.12"
1214
},

tsconfig.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": false,
4+
"emitDecoratorMetadata": true,
5+
"experimentalDecorators": true,
6+
"lib": ["es6", "dom"],
7+
"module": "es6",
8+
"moduleResolution": "node",
9+
"baseUrl": ".",
10+
"paths": {
11+
"*": ["node_modules/*", "app/javascript/*"]
12+
},
13+
"sourceMap": true,
14+
"target": "es5",
15+
"noEmit": true
16+
},
17+
"exclude": [
18+
"**/*.spec.ts",
19+
"node_modules",
20+
"vendor",
21+
"public"
22+
],
23+
"compileOnSave": false,
24+
"jsx": "react"
25+
}
26+

yarn.lock

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)