본문 바로가기

전체 글86

[React] Element UI 체크박스 적용 onChange에서 매개변수로 의 name값을 받게 되어있는데, 에 name속성을 사용하니까 빨간줄이 생기면서 에러 출력... No overload matches this call. index.d.ts 파일을 까보니까 name이 없었다... 프레임워크 UI가 이럴수가 있구나...ㅎ 더보기를 열면 주석해놓은 name 부분이 없어서 추가한 것. 더보기 // Checkbox interface CheckboxProps extends ElementReactLibs.ComponentProps { label?: string trueLabel?: string | number falseLabel?: string | number disabled?: boolean checked?: boolean // name?: strin.. 2021. 3. 24.
[React] parcel@1.12.4 오류로 인해 1.12.3으로 다운그레이드 파셀로 설치되어 관리되고 있는 리액트 프로젝트에 디펜던시로 설체되어 있는 1.12.4로 업그레이드 된 후 빌드하니깐 favicon.ico: Invalid Version: undefined 위와 같은 에러가 출력되면서 빌드가 안됨ㅠㅠ 구글링해보니깐 parcel@1.12.4 버전에 문제가 있었다. 바벨@7.13.9 버전의 babel API가 파셀에 의존성 제공을 안하는 그런 문제라고하는데,,, 그래서 다운그레이드가 필요했다. 일단 파셀을 글로벌로 설치했을 경우 parcel 명령어를 통해서 버전을 확인해볼 수 있다. parcel --version 1.12.4 1.12.4 버전을 삭제하고 1.12.3을 설치해보자. npm uninstall -g parcel-bundler npm install -g parcel-.. 2021. 3. 23.
[TypeScript] 타입과 인터페이스 Differences Between Type Aliases and Interfaces 인터페이스의 거의 모든 기능은 유형에서 사용할 수 있습니다. interface Animal { name: string } interface Bear extends Animal { honey: boolean } const bear = getBear() bear.name bear.honey type Animal = { name: string } type Bear = Animal & { honey: Boolean } const bear = getBear(); bear.name; bear.honey; 비슷하지만, 주요 차이점은 항상 확장 가능한 인터페이스와 비교하여 새 속성을 추가하기 위해 유형을 다시 열 수 없다는 것입니다... 2021. 3. 21.
[TypeScript] 기초와 유니온 안녕하세요! 코딩히송입니다. 오늘 포스팅은 타입스크립트 객체 타입 인터페이스를 관리하는 방법을 정리해보았습니다 :) 먼저, 익명으로 관리하는 것부터 살펴볼까요? const greet = (person: {name: string; age: number}) => { return "Hello" + person.age; }인터페이스 설정해서 관리하기: interface Person { name: string; age: number; } const greet = (person: Person) => { return "Hello" + person.age; }타입 별칭 사용해서 관리하기: type Person = { name: string; age: number; } const greet = (person: Perso.. 2021. 3. 21.
[TypeScript] .tsconfig 보일러 플레이트 제공 타입스크립트 .tsconfig 보일러플레이트 제공해드립니다. 본인 프로젝트에 맞게 커스텀해서 사용하시면되용 😁 📌 boilerplate: { "compilerOptions": { "target": "es6", "module": "commonjs", "lib": ["dom", "es2017", "esnext.asynciterable"], "sourceMap": true, "outDir": "./dist", "moduleResolution": "node", "removeComments": true, "strict": true, "noImplicitAny": true, "strictNullChecks": true, "strictFunctionTypes": true, "strictPropertyInitializ.. 2021. 3. 21.
[React] Babel Alias 절대경로 임포트하기 ../ 시작하는 것 대신 특정 별칭인 alias를 지정해서 절대경로를 바꿔볼거에요. 그러기 위해서는 babel-plugin-module-resolver가 필요합니다. // .babelrc [ "module-resolver", { "root": ["./"], "alias": { "elements": "./imports/ui/elements", "hooks": "./imports/ui/hooks", "state": "./imports/ui/globalState", "ui": "./imports/ui" "animation": "./imports/ui/animation", "api": "./api" } } ] 2021. 3. 21.