Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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

tsconfig.json, Typescript

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "jsxImportSource": "preact"
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: post jquery 
Javascript :: js hexadecimal 
Javascript :: Sorting an array of objects by property values 
Javascript :: queryselectorall javascript images in list 
Javascript :: form data object 
Javascript :: Summernote keyup event jquery 
Javascript :: laravel ajax post data to controller 
Javascript :: copy text on click 
Javascript :: js get selected option element 
Javascript :: react render after fetch 
Javascript :: npm is not recognized 
Javascript :: indexof method javascript 
Javascript :: how to get key from value in javascript 
Javascript :: regex js pattern tags 
Javascript :: npm i postman 
Javascript :: str replace javascript all 
Javascript :: useReducer 
Javascript :: select selected option value jquery 
Javascript :: javascript dump strack trace 
Javascript :: split array into chunks javascript 
Javascript :: javascript create node from innerhtml 
Javascript :: set localstorage 
Javascript :: how to convert seaconds into hh:mm:ss in javascript 
Javascript :: jquery get all input name and values and submit 
Javascript :: angular material remove outline 
Javascript :: Web History API 
Javascript :: print chart js 
Javascript :: remove element from array by name javascript 
Javascript :: select element by id 
Javascript :: regex data 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =