0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

TypeScriptの環境構築

Posted at

この記事の概要

TypeScriptの環境構築について記載する

TypeScriptの環境構築

Node.jsのインストール(npmのインストール)

// homebrewのインストール
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
// nodebrewのインストール
$ brew install nodebrew
$ nodebrew --version
$ nodebrew ls-remote
// node.js(npm)のインストール
$ mkdir ~/.nodebrew/src
$ nodebrew install-binary stable
$ nodebrew ls
$ nodebrew use v18.4.0
$ echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.zshrc

上記のページからHombrewインストール用のコマンドを取得

node.jsインストール時にエラーが起こるので上記を参考に対応

TypeScriptのインストール

// TypeScriptのインストール
$ npm install -g typescript
$ tsc -v

TypeScriptを使ってみる

hello.ts
const message:string = 'Hello! TypeScript!';
console.log(message);
// tsをjsにコンパイル
tsc hello.ts
// jsファイルを実行
node hello.js
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?