コンパイラに型を指示する。実行時には影響なし
const input = document.getElementById('q') as HTMLInputElement;
input.value = 'hello';
// unknown経由の二段アサーション
const x = someValue as unknown as TargetType;
// satisfies演算子 (TS 4.9) — 型チェックしつつ推論を保持
const config = {
port: 3000, host: 'localhost',
} satisfies Record<string, string | number>;型推論で解決できない場合の最終手段として使う。過度な使用は型安全性を下げる。satisfiesは型チェックしながら推論を保持する。