- アロー関数とアロー〈二重矢印記号〉を使った関数空間型の記述
- declareを使った外部環境の型宣言
- オンライン・プレイグラウンド
対応:
| TypeScript | 疑似言語 |
|---|---|
| function | theorem |
| const | evidence |
| declare function | axiomatic theorem |
| declare const | axiomatic evidence |
| declare class -{} | variable (- : Prop) |
| { | proof |
| } | end |
中身不明の型の宣言 declare type A; は無理。代わりに declare class A{}; 、これは型引数ではない型変数の宣言。
実際のdeclareの例:
declare const foo: number; declare function greet(greeting: string): void;