87e38cef7adf7a781f007057fcd89275.png

yarn add typescript ts-loader -D
1

1
const path = require('path');

module.exports = {
    mode: 'production',
    entry: './src/index.tsx',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [
            {
                test: /\.tsx$/,
                use: 'ts-loader'
            }
        ]
    }
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

tsconfig.json

9b38b63343ee30cddd8506765f8e4a2b.png

lodash类型检查

2c9f34a74772127f27a2624a1e045414.png