반응형
tsconfig.json
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"target": "es5",
"lib": ["es2015", "dom", "dom.iterable"],
"noImplicitAny": false,
"strict": true,
"strictFunctionTypes": true
},
"include": ["./src/**/*"]
}
noImplicitAny
- 암묵적으로 any를 추론하게 하지말고 Type에 any라도 무조건적으로 명시하도록 설정
strict
- strict플래그는 광범위한 유형 검사 동작을 활성화하여 프로그램 정확성을 더욱 강력하게 보장합니다.
- 이 기능을 켜는 것은 아래에 설명된 모든 엄격 모드 제품군 옵션을 활성화하는 것과 같습니다 .
- 그런 다음 필요에 따라 개별 엄격 모드 제품군 검사를 끌 수 있습니다.
strictFunctionTypes
- 이 플래그를 활성화하면 함수 매개변수가 더 정확하게 확인됩니다.
참고 - Typescript 공식 TSCofing Reference
https://www.typescriptlang.org/tsconfig#strictFunctionTypes
TSConfig Reference - Docs on every TSConfig option
From allowJs to useDefineForClassFields the TSConfig reference includes information about all of the active compiler flags setting up a TypeScript project.
www.typescriptlang.org
.eslintrc.js
module.exports = {
root: true,
env: {
browser: true,
node: true,
jest: true,
},
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['prettier', '@typescript-eslint'],
rules: {
'prettier/prettier': [
'error',
{
singleQuote: true,
semi: true,
useTabs: false,
tabWidth: 2,
printWidth: 80,
bracketSpacing: true,
arrowParens: 'avoid',
},
],
// '@typescript-eslint/no-explicit-any': 'off',
// "@typescript-eslint/explicit-function-return-type": 'off',
'prefer-const': 'off',
},
parserOptions: {
parser: '@typescript-eslint/parser',
},
};
반응형
'TypeScript > TypeScript - 기초부터 실전까지' 카테고리의 다른 글
19. 클래스 선언부 타입 정의 | 메서드 타입 정의 | enum을 이용한 타입 정의 (0) | 2023.10.14 |
---|---|
18. API 함수 타입 정의 | Promise<Contact[]> (0) | 2023.10.14 |
16. 제네릭의 타입 제한방법 3가지 | keyof (0) | 2023.10.09 |
15. 제네릭 실전 예제 - DropDown | 인터페이스에 제네릭을 선언하는 방법 (0) | 2023.10.08 |
14. 제네릭 | 기본 문법 | 기존타입 정의, 유니온 타입을 이용한 선언 방식의 문제점과 제네릭의 장점 (0) | 2023.10.08 |