• 追加された行はこの色です。
  • 削除された行はこの色です。
#author("2019-10-09T14:20:49+09:00","default:ryuichi","ryuichi")
#author("2019-10-09T14:24:02+09:00","default:ryuichi","ryuichi")
* キャスト [#w07a1280]

 let msg: any = "hello";
 
 let len = (msg as string).length;
 let len2 = (<string>msg).length;

- JSXで使う場合は<string>だとまずいので、asを使うらしい

** 参考 [#u03fdc02]

https://basarat.gitbooks.io/typescript/docs/types/type-assertion.html


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS