Más contenido relacionado
La actualidad más candente (19)
Similar a TypeScript 型定義ファイルのある開発 TypeScript勉強会 VSハッカソン倶楽部 (20)
Más de Masahiro Wakame (20)
TypeScript 型定義ファイルのある開発 TypeScript勉強会 VSハッカソン倶楽部
- 3. • Google App Engine!
• Android!
• Google Apps!
などなど、!
!
!
技術に特化した会社です。!
Microsoft?
- 9. Why needs 型?
• 多くのエラーをコンパイル時に!
• 実行時エラーはもううんざり!!
• 間違った使い方は不可能に!
• リファクタリングも安心確実!!
• コンパイルが通ればある程度動く!!
• IDEなどのサポートが得られやすい
JS完全互換!
- 17. interface Moment {
!
format(format: string): string;
format(): string;
!
fromNow(withoutSuffix?: boolean): string;
!
startOf(soort: string): Moment;
endOf(soort: string): Moment;
!
add(input: MomentInput): Moment;
add(soort: string, aantal: number): Moment;
add(duration: Duration): Moment;
subtract(input: MomentInput): Moment;
subtract(soort: string, aantal: number): Moment;
!
calendar(): string;
clone(): Moment;
!
valueOf(): number;
!
local(): Moment; // current date/time in local mode
!
utc(): Moment; // current date/time in UTC mode
!
既存JSに型を後付けする
http://momentjs.com/
goo.gl/9QnuC3
- 21. .d.ts 利用例
• FunScript!
• F# to JavaScript!
• Scala.js!
• scala.js ts importer!
• dts-parser!
• TypedCoffeeScript by mizchi
- 22. in Pure JavaScript
• WebStorm (JetBrains社のIDE)!
• 通常のJSコード書きにも使える!!
• JavaScript > Libraries > Download >
TypeScript community stubs
- 33. How to write .d.ts?
• 普通にライブラリ使う時と変わらない!
• APIリファレンスを読む!
• 実装を読む!
• 実行してみて確かめる
時間余ったら実演します
- 40. new operator
• new 演算子を使う対象!
• class!
• interface (class decomposition)!
• 具体例!
• goo.gl/qD60Vi
interfaceが主流?
- 43. 命名規則
• JSの流儀に従う!
• クラス名は先頭大文字 Sample!
• モジュール名もかな…!
• 変数、メソッド キャメルケース fooBar!
• インタフェースは先頭I付き ISample!
• ↑賛否両論 ちょとおすすめ ぐらい
C#erはメソッド先頭大文字多いですね
それはどうかと思うけど…