TypeScript
こんな感じのオブジェクトに const obj = { hoge: "", fuga: "", piyo: "" }; null なプロパティを追加すると怒られる const obj = { hoge: "", fuga: "", piyo: "", xxx: null }; any 型の object だとプロパティに any を許容するけどこの場合は型推論が働…
compileOptions で target を es6 にしておけば import {Promise} from 'es6-promise' は不要らしい 準備 % mkdir practice-ts-pattern && cd $_ % npm init --yes create tsling.json: % tslint --init % cat << EOF > tsconfig.json { "version": "1.7.5",…
どうした? とりあえず環境を用意します % mkdir practice-ts-callback && cd $_ % tslint init % npm init --yes % npm install co --save % dtsm init % dtsm install node --save ひとまず compilerOptions は以下のようにします。 create tsconfig.json:…
どうした? callback 地獄は嫌いです。 それで? とりあえず環境を用意します % mkdir practice-ts-generatpr && cd $_ % tslint init % npm init --yes % npm install co --save % dtsm init % dtsm install node --save create generator.ts: /// <reference path="./typings/bundle.d.ts" /> const c</reference>…
Story: あらすじ ひょんな事から TypeScript で Node.js のサーバーサイドエンジニアやる事になりました。 Enviroments: 環境 % sw_vers ProductName: Mac OS X ProductVersion: 10.11.3 BuildVersion: 15D21 % node -v v4.2.6 % npm -v 2.14.12 % tsc -v me…