일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- JavaScript
- import.meta.env
- SSR
- msw
- svelte
- vue
- Testing
- TLS
- http3
- https
- vue3
- Cypress
- e2e
- caching
- typeScript
- csr
- 비동기
- rendering
- custom command
- ViTE
- CloudFlare
- api test
- web vital
- aws
- 선택자
- vue-cli
- QUIC
- CSS
- ts error
- devtools
- Today
- Total
목록Language/Typescript (6)
Develop Note by J.S.

1. Enum - Enum은 열거형 변수를 객체행태로 정의한 상수의 집합을 생성합니다. 임의의 숫자 또는 문자열을 상수화하여 관리하는 기능입니다. // 숫자 타입(열거형) enum Fruit { apple, // 1 banana, // 2 carrot, // 3 } // 문자열 타입 enum Fruit { apple = 'apple', banana = 'banana', carrot = 'carrot' } function setFruit(fruit :Fruit) { // ... } setFruit(Fruit.apple); - 이렇게 편리해보이는 Enum도 3가지 문제로 인해 대부분의 커뮤니티에서는 Enum 대신 Union Type 사용을 권장하고 있습니다. 1) 타입 오염 (Heterogeneous enu..

verbatimModuleSyntax Typescript 5.0 부터 Module elision(생략)를 명확하게 할 수 있는 옵션입니다. 만약 Type 지정만을 위한 import일 경우 빌드 시 해당 import가 삭제(elision)되는데, 해당 옵션으로 인해, type지정을 위한 import인 경우 type-only 형식으로 import해야 합니다. 1) Error Message 2) Type 키워드 사용

아래와 같은 TS2345 Error 발생 시 1. cypress/global.d.ts 생성 // ./cypress/global.d.ts declare namespace Cypress { interface Chainable { dataCy(dataTestAttribute: string): Chainable } } 2. tsconfig.json // tsconfig.json cypress 경로 추가 "include": ["cypress/**/*.ts" ,"src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],

1. TS2339 Error Vite에서 환경변수 import.meta.env 사용 시 TS2339 Error 발생 2. 조치 방법 tsconfig.json compilerOptions.types에 "vite/client"를 추가하면 해결됩니다. //tsconfig.json "compilerOptions": { ... "types": ["node", "vite/client"], }

Vite로 Vue Project 생성 시 아래와 같은 에러가 발생합니다 . 이때 ./src/ 하위에 shims-vue.d.ts 타입 추론 파일을 생성 한 뒤 아래 코드를 입력해주시면 에러가 발생되지 않습니다. declare module '*.vue' { import type { DefineComponent } from 'vue'; const component: DefineComponent; export default component; } declare module '*.scss'; //scss 사용 시
Typescript로 개발할 때 tsconfig.json에서 주로 사용되는 속성에 관하여 정리해보았습니다. 1. CompilerOptions { "compilerOptions": { "target": "es5", "module": "commonjs", "allowJs": true, "composite": true, "noImplicitAny": true, "removeComments": true, "baseUrl": "./" "paths": { "@/*": ["./src/*"] } "outFile": "./", "outDir": "./", "rootDir": "./", } } target : Compile시에 Typescript 코드를 어떤 버전의 javascript 코드로 변경할지에 대한 설정 modu..