Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

generate tsconfig

npx tsc --init
Comment

tsconfig

{
  "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"
  ]
}
Comment

typescript tsconfig.json file

{
  "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"]
}

Comment

init tsconfig file

// 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.
Comment

basic tsconfig file

{
    "compilerOptions": {
      "outDir": "./dist/",
+     "sourceMap": true,
      "noImplicitAny": true,
      "module": "commonjs",
      "target": "es5",
      "jsx": "react",
      "allowJs": true,
      "moduleResolution": "node",
    }
  }
Comment

generate tsconfig

[1] $ tsc -v
[2] If the version is older than 1.6:
	$ npm install -g typescript
[3] $ tsc --init
Comment

tsconfig.json

// mytsconfig.
{
    "compilerOptions": {
        "allowJs": true,
        "checkJs": false,
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "typeRoots": ["src/types", "node_modules/@types"],
        "baseUrl": "src",
        "paths": {
            "@/*": ["*"] // matching @src/* to src/*
        },
        "outDir": "dist",
        "experimentalDecorators": true,
        
    },
    "exclude": ["node_modules", "dist"],
    "include": ["src/**/*","src/*"]
}
Comment

PREVIOUS NEXT
Code Example
Typescript :: google sheets sumif 
Typescript :: echarts cdn 
Typescript :: how to validate email address in typescript 
Typescript :: mixed array typescript 
Typescript :: absolute cell reference in excel and google sheets 
Typescript :: latex two plots in 1 
Typescript :: bash all arguments except last 
Typescript :: activate jquery in typescript 
Typescript :: react typescript create react app 
Typescript :: making barplots in r 
Typescript :: how to add 2 bind events on one button tkinteer 
Typescript :: nodemailer typescript 
Typescript :: tsconfig paths not working react native 
Typescript :: subplots in for loop python 
Typescript :: how to compare two lists element by element in python and return matched element 
Typescript :: basic variable types typescript 
Typescript :: typescript type from array 
Typescript :: how to send attachments to node mailer file not found 
Typescript :: how to install downloaded requirements pip with python 
Typescript :: web.contents timeout 
Typescript :: How to Convert MATLAB Scripts to Python 
Typescript :: Fill in the right keywords to test the conditions: 
Typescript :: in grunt cannot be loaded because running scripts is disabled on this system 
Typescript :: how to register events bukikt 
Typescript :: print all alphabets from a to z in java 
Typescript :: google sheets loops with if statement 
Typescript :: Interface with custom property name types 
Typescript :: switch in typescript 
Typescript :: makestyles material ui typescript 
Typescript :: has apple distribution certificate installed but its private key 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =