PHP에서 Node.js 로의 전환을 심각하게 고려하고 있습니다. 하지만 저는 Javascript에서 프로토 타이핑을 정말 좋아하지 않기 때문에 Typescript를 선호합니다.Node.js 대소 문자 포함
저는 Visual Studio 2013에서 기본 사항을 테스트하고 새로운 (Typescript) Express 프로젝트를 만들었습니다. Node.js for Visual Studio이 설치되어 있습니다.
다음class Animal {
name: string;
constructor(theName: string) { this.name = theName; }
move(meters: number) {
alert(this.name + " moved " + meters + "m.");
}
}
class Snake extends Animal {
constructor(name: string) { super(name); }
move() {
alert("Slithering...");
super.move(5);
}
}
class Horse extends Animal {
constructor(name: string) { super(name); }
move() {
alert("Galloping...");
super.move(45);
}
}
내가 app.ts 다음 코드 조각을 추가 :
나는 타이프 스크립트 튜토리얼에서 다음 코드라는 animals.ts 파일을 추가, tstests라는 디렉토리를 생성/// <reference path='tstests/animals.ts'/>
var sam = new Snake("Sammy the Python");
sam.move();
IntelliSense와 프로젝트 작업을 모두 빌드하지만 프로젝트를 실행하려고하면 ReferenceError가 발생합니다. Snake가 정의되지 않았습니다.
아무도 내가 이것을 해결해야하는 방법을 설명 할 수 있습니까?
더 자세히 설명합니다. https://www.youtube.com/watch?v=KDrWLMUY0R0&hd=1 – basarat