型の互換性
型の互換性(Type Compatibility)
let str: string = "Hello";
let num: number = 123;
str = num; // ERROR: `number` is not assignable to `string`
num = str; // ERROR: `string` is not assignable to `number`健全性(Soundness)
let foo: any = 123;
foo = "Hello";
// Later
foo.toPrecision(3); // Allowed as you typed it as `any`構造的(Structual)
バリアンス(Variance)
関数(Functions)
戻り値の型(Return Type)
引数の数
オプションおよび可変長(Rest)パラメータ
引数のタイプ
列挙型(Enums)
クラス(Classes)
ジェネリクス(Generics)
ノート: Invariance
最終更新