TypeScript 학습? 데노를 시도
3742 단어 beginnerstypescriptdenonode
설치
Mac에서는
brew install deno, Windows 시스템에서는 choco install deno만큼 간단합니다. 자세한 지침은 installation is here .운영
Deno는 인터넷에서 호스팅되는 모든 JS 또는 TS 파일을 실행할 수 있습니다.
$ deno run https://deno.land/std/examples/welcome.ts
또는 유효한 TypeScript 파일을 로컬로 작성해 보겠습니다.
// save this as welcome.ts
interface Account {
id: number
displayName: string
version: 1
}
function welcome(user: Account) {
console.log('Welcome,', user.displayName)
}
welcome({ id: 1, displayName: 'Dina', version: 1 })
위의 파일을 저장하고 아래와 같이 직접 실행합니다. Deno는 코드를 컴파일하고 실행합니다. 시작하려면 will
.tsconfig 파일이나 실행tsc 등을 처리할 필요가 없습니다. psst가 급하고 TS를 배우고 싶지만 Deno에 관심이 없다면 TS repl 및 실행 환경을 사용할 수 있습니다. 호출됨ts-node$ deno run welcome.ts
Check file:///Users/dina/dev/try-deno/welcome.ts
Welcome, Dina
개발자 경험
Deno는 deno 실행 파일에서 코드 린터, 포맷터 및 테스트 러너와 같은 훌륭한 DX를 providing tools 제공합니다.
린트
$ deno lint
(prefer-const) `order` is never reassigned
let order = new Order()
^^^^^
at /Users/dina/try-deno/design-patterns/state.ts:106:4
hint: Use `const` instead
help: for further information visit https://lint.deno.land/#prefer-const
Found 24 problems
Checked 25 files
체재
$ deno fmt
/Users/dina/try-deno/design-patterns/decorator.ts
/Users/dina/try-deno/design-patterns/state.ts
Checked 30 files
테스트
$ deno test feature.spec.ts
내 두 센트
Node.js가 곧 사라질 것이라고 생각하지 않습니다. Deno는 훌륭한 대안이지만 아직 많이 개발 중입니다. Node.js에는 아직 변환되지 않았거나 Deno에서 사용할 수 있는 라이브러리 및 유틸리티의 거대한 생태계가 있습니다. 좋은 점은 이전에는 경쟁이 많지 않았기 때문에 Deno의 도입으로 Node.js가 성숙해 졌다는 것입니다. deno는 어떤 웹 조각을 얻게 될까요? 단지 시간이 말해 줄 것이다. 👋
Reference
이 문제에 관하여(TypeScript 학습? 데노를 시도), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/dnafication/learning-typescript-try-deno-4pen텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)