xxxxxxxxxx
{
"compilerOptions": {
"module": "esnext",
"target": "es2016",
"jsx": "react-jsx",
"strictFunctionTypes": true,
"sourceMap": true,
"outDir": "./build",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
},
"exclude": ["node_modules", "**/node_modules/*"],
"include": ["src", "electron/renderer.ts"]
}
xxxxxxxxxx
{
"compilerOptions": {
"module": "commonjs",
"outDir": "dist/",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true
},
"include": [
"*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
xxxxxxxxxx
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
xxxxxxxxxx
// source from https://stackoverflow.com/questions/36916989/how-can-i-generate-a-tsconfig-json-file
$ tsc --init
// Try to run in your console the following to check the version:
$ tsc -v
// If the version is older than 1.6 you will need to update:
$ npm install -g typescript
// Remember that you need to install node.js to use npm.
xxxxxxxxxx
{
"compilerOptions": {
"outDir": "./dist/",
+ "sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"allowJs": true,
"moduleResolution": "node",
}
}
xxxxxxxxxx
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src"]
}
xxxxxxxxxx
[1] $ tsc -v
[2] If the version is older than 1.6:
$ npm install -g typescript
[3] $ tsc --init
xxxxxxxxxx
{
"scripts": {
"start": "node -r tsconfig-paths/register -r ts-node
./src/index/ts",
"build": "tsc --project tsconfig.json && tscpaths -p
tsconfig.json -s ./src -o ./dist"
}
}