Skip to content

Commit

Permalink
ch10-5~6
Browse files Browse the repository at this point in the history
  • Loading branch information
becho2 committed Sep 14, 2022
1 parent 7207e3d commit 294c0e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
4. npm i -D @types/node // 자바스크립트로 개발된 라이브러리를 타입스크립트에서 쓸 수 있게 @types/??? 설치
// 3, 4의 설치과정을 진행하면 설치한 패키지들의 목록이 package.json에 자동으로 등록됨
(package.json이 이미 있다면, npm i 로 전부 설치 - 다른 사람의 프로젝트를 받는 등의 경우 node_modules 폴더는 이렇게 자동으로 생성/파일로 주고받지 않음)
5. tsc --init // 타입스크립트 프로젝트 생성 - tsconfig.json 생성됨
5. tsc -init // 타입스크립트 프로젝트 생성 - tsconfig.json 생성됨
6. tsconfig.json 내용 적절하게 설정 - 53페이지에 설명
7. mkdir -p src/utils
8. package.json 파일에 npm스크립트 추가 -> dev, build 명령을 추가하여 npm run dev, npm run build 명령어를 통해 "ts-node src" / "tsc && node dist" 를 실행할 수 있게 됨
Expand Down
6 changes: 3 additions & 3 deletions ch10/src/flyOrSwim.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Bird, Fish } from "./BirdAndFish";

export const flyOrSwim = (o: Bird | Fish): void => {
console.log(o);
if(o instanceof Bird){
console.log(o);
o.fly();
} else if(o instanceof Fish){
o.swim();
}
}
}


0 comments on commit 294c0e3

Please sign in to comment.