特定の文字列や数値のみを許容する[[TypeScript]]の型定義。 ```ts const id = 180702 // ^? const id: 180702 const _name = "tadashi" // ^? const _name: "tadashi" ``` <button class="playground"><a href="https://www.typescriptlang.org/play?#code/MYewdgzgLgBAlgExgXhgRgBwAYDsWBMAUAPTEzkwB6A-IaJLAPpgCGAtgKYowBEULCFhAAWcHiTIUahIA">Playground</a></button> 上記は`const`で宣言しており、再代入できないため[[リテラル型 (TypeScript)|リテラル型]]として扱われる。 ## MOC - 📒**関連** - [[文字列リテラル型 (TypeScript)|文字列リテラル型]] - 📜**アクティビティ** - 📝**トラブルシューティング**