Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.

Commit 7e6ff4b

Browse files
authored
[IMPROVE] Add TypeScript (#694)
1 parent 6a16d3b commit 7e6ff4b

File tree

6 files changed

+82
-8
lines changed

6 files changed

+82
-8
lines changed

.eslintrc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,19 @@
5151
"no-sequences": "off"
5252
},
5353
"settings": {
54-
"react": {
55-
"pragma": "h",
56-
"pragmaFrag": "Fragment",
57-
"version": "detect"
58-
}
54+
"import/resolver": {
55+
"node": {
56+
"extensions": [
57+
".js",
58+
".ts",
59+
".tsx"
60+
]
61+
}
62+
},
63+
"react": {
64+
"pragma": "h",
65+
"pragmaFrag": "Fragment",
66+
"version": "detect"
67+
}
5968
}
6069
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"stylelint": "^13.6.1",
7878
"stylelint-order": "^4.1.0",
7979
"svg-loader": "^0.0.2",
80+
"ts-loader": "^8.3.0",
81+
"typescript": "^4.6.3",
8082
"url-loader": "^4.1.0",
8183
"webpack": "^4.44.1",
8284
"webpack-cli": "^3.3.12",
File renamed without changes.

tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compilerOptions": {
3+
"module": "CommonJS",
4+
"moduleResolution": "node",
5+
"target": "es2018",
6+
"outDir": "./dist",
7+
"allowJs": true,
8+
"checkJs": false,
9+
10+
"noImplicitAny": true,
11+
},
12+
"exclude": [
13+
"./node_modules",
14+
"./build"
15+
]
16+
}

webpack.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module.exports = (env, argv) => [
1212
extensions: [
1313
'.js',
1414
'.jsx',
15+
'.ts',
16+
'.tsx',
1517
],
1618
alias: {
1719
react: 'preact/compat',
@@ -52,6 +54,13 @@ module.exports = (env, argv) => [
5254
'babel-loader',
5355
],
5456
},
57+
{
58+
test: /\.tsx?$/,
59+
use: 'ts-loader',
60+
exclude: [
61+
'/node_modules/',
62+
],
63+
},
5564
{
5665
test: /\.svg$/,
5766
use: [
@@ -217,6 +226,8 @@ module.exports = (env, argv) => [
217226
extensions: [
218227
'.js',
219228
'.jsx',
229+
'.ts',
230+
'.tsx',
220231
],
221232
alias: {
222233
react: 'preact/compat',
@@ -259,6 +270,13 @@ module.exports = (env, argv) => [
259270
},
260271
],
261272
},
273+
{
274+
test: /\.tsx?$/,
275+
use: 'ts-loader',
276+
exclude: [
277+
'/node_modules/',
278+
],
279+
},
262280
],
263281
},
264282
},

yarn.lock

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,7 +3834,7 @@ braces@^2.3.1, braces@^2.3.2:
38343834
split-string "^3.0.2"
38353835
to-regex "^3.0.1"
38363836

3837-
braces@^3.0.1, braces@~3.0.2:
3837+
braces@^3.0.1, braces@^3.0.2, braces@~3.0.2:
38383838
version "3.0.2"
38393839
resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz"
38403840
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
@@ -5917,7 +5917,7 @@ endent@^2.0.1:
59175917
fast-json-parse "^1.0.3"
59185918
objectorarray "^1.0.5"
59195919

5920-
enhanced-resolve@^4.1.1, enhanced-resolve@^4.3.0:
5920+
enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.1, enhanced-resolve@^4.3.0:
59215921
version "4.5.0"
59225922
resolved "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.5.0.tgz"
59235923
integrity sha512-Nv9m36S/vxpsI+Hc4/ZGRs0n9mXqSWGGq49zxb/cJfPAQMbUtttJAlNPS4AQzaBdw/pKskw5bMbekT/Y7W/Wlg==
@@ -10002,6 +10002,14 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4:
1000210002
snapdragon "^0.8.1"
1000310003
to-regex "^3.0.2"
1000410004

10005+
micromatch@^4.0.0:
10006+
version "4.0.5"
10007+
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
10008+
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
10009+
dependencies:
10010+
braces "^3.0.2"
10011+
picomatch "^2.3.1"
10012+
1000510013
micromatch@^4.0.2, micromatch@^4.0.4:
1000610014
version "4.0.4"
1000710015
resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz"
@@ -11198,6 +11206,11 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3:
1119811206
resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz"
1119911207
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==
1120011208

11209+
picomatch@^2.3.1:
11210+
version "2.3.1"
11211+
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
11212+
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
11213+
1120111214
pidtree@^0.3.0:
1120211215
version "0.3.1"
1120311216
resolved "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz"
@@ -13219,7 +13232,7 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
1321913232
resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz"
1322013233
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
1322113234

13222-
semver@^7.2.1, semver@^7.3.2:
13235+
semver@^7.2.1, semver@^7.3.2, semver@^7.3.4:
1322313236
version "7.3.5"
1322413237
resolved "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz"
1322513238
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
@@ -14473,6 +14486,17 @@ ts-essentials@^2.0.3:
1447314486
resolved "https://registry.npmjs.org/ts-essentials/-/ts-essentials-2.0.12.tgz"
1447414487
integrity sha512-3IVX4nI6B5cc31/GFFE+i8ey/N2eA0CZDbo6n0yrz0zDX8ZJ8djmU1p+XRz7G3is0F3bB3pu2pAroFdAWQKU3w==
1447514488

14489+
ts-loader@^8.3.0:
14490+
version "8.3.0"
14491+
resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-8.3.0.tgz#83360496d6f8004fab35825279132c93412edf33"
14492+
integrity sha512-MgGly4I6cStsJy27ViE32UoqxPTN9Xly4anxxVyaIWR+9BGxboV4EyJBGfR3RePV7Ksjj3rHmPZJeIt+7o4Vag==
14493+
dependencies:
14494+
chalk "^4.1.0"
14495+
enhanced-resolve "^4.0.0"
14496+
loader-utils "^2.0.0"
14497+
micromatch "^4.0.0"
14498+
semver "^7.3.4"
14499+
1447614500
ts-pnp@^1.1.6:
1447714501
version "1.2.0"
1447814502
resolved "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz"
@@ -14593,6 +14617,11 @@ typedarray@^0.0.6:
1459314617
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz"
1459414618
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
1459514619

14620+
typescript@^4.6.3:
14621+
version "4.6.3"
14622+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.3.tgz#eefeafa6afdd31d725584c67a0eaba80f6fc6c6c"
14623+
integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==
14624+
1459614625
uc.micro@^1.0.1, uc.micro@^1.0.5:
1459714626
version "1.0.6"
1459814627
resolved "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz"

0 commit comments

Comments
 (0)