尝试编写打字稿项目。这是我的项目结构。
rootdir
|
|-----src
| |----server.ts
| |----other folders
|-----node_modules
|-----tsconfig.json
|-----package.json
Run Code Online (Sandbox Code Playgroud)
tsconfig.json
{
"compilerOptions": {
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"resolveJsonModule": true,
"outDir": "./dist" /* Redirect output structure to the directory. */,
"rootDir": "./src" /* Specify the root directory of input files. Use to
/* Strict Type-Checking Options …
Run Code Online (Sandbox Code Playgroud)