最終更新:2021-09-04 (土) 01:11:43 (969d)
TypeScript/基本型
Top / TypeScript / 基本型
https://www.typescriptlang.org/docs/handbook/basic-types.html
基本型
TypeScript/boolean?
- trueかfalse
TypeScript/number?
- 数値 (整数や浮動小数点数)
- 2の53乗まで
TypeScript/bigint?
- TypeSctipt 3.2?
TypeScript/string?
- 文字列
- バッククオートでテンプレート文字列
TypeScript/配列
let list: number[] = [1, 2, 3]; let list: Array<number> = [1, 2, 3];
TypeScript/タプル
let x: [string, number];
TypeScript/enum?
enum Color { Red, Green, Blue, }
TypeScript/unknown
TypeScript/any
- すべての型を代入可能
TypeScript/void?
TypeScript/undefined
- 型、初期値ともになしだとundefined
TypeScript/null?
- nullのみ代入できる
TypeScript/never?
TypeScript/オブジェクト型?
TypeScript/辞書
TypeScript/合併型
- string | number
TypeScript/リテラル型?
strictNullChecks?
- OFFの場合はnullとundefinedが同じ型
- TypeScript 2.0?