$ npn init -y
$ npm i -D typescript
"script" : {
"tsc" : "tsc"
}
{
"compilerOptions": {
"strict" : true,
"target": "ES2015", //ES6, ESnext
"outDir": "dist", //출력은 어떤 디렉토리에?
"baseUrl": "./" // ./ 경로에 dist폴더를 만들어라
} ,
"include" : [
"src/**/*.ts"
]
}
main.ts
interface User {
name: string
age: number
}
const user:User = {
name: 'Heropy',
age: 85
}
console.log(user)
$ npm run tsc
$ npm i -D eslint @typescript-eslint/eslint-plungin @typescript-eslint/parser
.eslintrc.json
{
"env": {
"browser": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
],
"parser": "@typescript-eslint/parser",
"rules": {
"semi": ["error", "never"],
"quotes": ["error", "single"],
"eol-last": ["error", "always"],
//"@typescript-eslint/no-explicit-any": "error" //or "warn"
}
}