Skip to content

Commit 68c139d

Browse files
committed
initiate typescript
1 parent ce87671 commit 68c139d

6 files changed

Lines changed: 417 additions & 5 deletions

File tree

craco.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
const path = require('path')
2+
13
module.exports = {
24
webpack: {
5+
alias: {
6+
'@': path.resolve(__dirname, 'src'),
7+
},
38
configure: {
49
output: {
510
filename: 'static/js/[name].js',

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
"private": false,
55
"dependencies": {
66
"@amplitude/analytics-browser": "^1.5.3",
7+
"@craco/craco": "^6.4.5",
78
"@testing-library/jest-dom": "^5.11.4",
89
"@testing-library/react": "^11.1.0",
910
"@testing-library/user-event": "^12.1.10",
11+
"@types/jest": "^29.1.2",
12+
"@types/node": "^18.11.0",
13+
"@types/react": "^18.0.21",
14+
"@types/react-dom": "^18.0.6",
1015
"axios": "^0.21.2",
1116
"axios-cache-adapter": "^2.7.3",
1217
"country-emoji": "^1.5.4",
@@ -30,11 +35,12 @@
3035
"react-tooltip": "^4.2.21",
3136
"styled-components": "2",
3237
"timeago.js": "^4.0.2",
38+
"typescript": "^4.8.4",
3339
"web-vitals": "^0.2.4"
3440
},
3541
"proxy": "https://api.hackertab.dev/",
3642
"scripts": {
37-
"start": "react-scripts start",
43+
"start": "craco start",
3844
"web-build": "REACT_APP_WEB_BUILD=1 CI= react-scripts --max_old_space_size=3072 build",
3945
"build": "./script/build.sh",
4046
"stores-build": "./script/stores_build.sh",

src/react-app-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="react-scripts" />

tsconfig.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
9+
"allowJs": true,
10+
"skipLibCheck": true,
11+
"esModuleInterop": true,
12+
"allowSyntheticDefaultImports": true,
13+
"strict": true,
14+
"forceConsistentCasingInFileNames": true,
15+
"noFallthroughCasesInSwitch": true,
16+
"module": "esnext",
17+
"moduleResolution": "node",
18+
"resolveJsonModule": true,
19+
"isolatedModules": true,
20+
"noEmit": true,
21+
"jsx": "react-jsx"
22+
},
23+
"include": [
24+
"src"
25+
],
26+
"exclude": [
27+
"node_modules"
28+
],
29+
"extends": "./tsconfig.paths.json"
30+
}

tsconfig.paths.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"@/*": ["./src/*"]
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)