일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 리액트네이티브아이콘
- extends
- forwardref type
- 타입스크립트
- async
- 스크롤이벤트
- 안드로이드빌드에러
- generic
- 상속
- materialicons
- app:compiledebugkotlin
- interface
- javascript
- 슬라이딩윈도우
- set
- map
- app.post
- reactnative
- mainapplication.kt
- Spring
- Filter
- 배열중복요소제거
- Next.js
- 이진탐색
- err_connection_refused
- TS
- npm에러
- array
- react
- reactnative error
- Today
- Total
목록타입스크립트 (3)
rhanziy
자바스크립트는 타입에 관대하기 때문에 큰 프로젝트할 때 예상치 못한 에러나 버그가 발생할 수 있다. 그래서 엄격한 타입룰을 지정해주면서 더 정확한 에러메세지를 얻기위해 타입스크립트를 사용함. 설치 1. 일단 Node.js 최신버전, VScode 에디터오픈 2. 터미널 오픈 후 npm install -g typescript 3. 코드 짤 작업폴더 만들고 에디터에서 오픈 4. 작업폴더에 .ts로 끝나는 파일 만들고 사용시작하면됨. 여기서 .ts 파일은 브라우저에서 알아듣지 못하기 때문에 js파일로 변환작업이 필요한데, 터미널에 tsc -w 를 입력해두면 자동으로 js파일로 변환해준다. 그런데! 여기서 오류가 발생할 것. 아마도 이 시스템에서 스크립트를 실행할 수 없으므로~~ 어쩌구. 해결은 윈도우 파워쉘을 ..
interface SStorage { [key:string] : T } class LocalStorage { private storage: SStorage = {} set(key:string, value:T){ this.storage[key] = value; } remove(key:string){ delete this.storage[key] } get(key:string):T { return this.storage[key] } clear(){ this.storage = {} } } const stringsStorage = new LocalStorage() stringsStorage.get("key") stringsStorage.set("hello", "how are you") const booleanSt..
abstract class User { constructor( protected firstName: string, protected lastName:string ){} abstract sayHi(name:string):string abstract fullName():string } class Player2 extends User { sayHi(name:string){ return `Hello ${name}. My name is ${this.fullName()}` } fullName(){ return `#{this.firstName} ${this.lastName}` } } 타입스크립트에서 추상클래스를 구현하면 자바스크립트에서 컴파일했을 때 일반적인 클래스로 바뀌어버림. class User { constru..