TypeScriptのよく使う型メモ

number

const hoge: number = 3;

Arrayの中に数値

const hoge: number[] = [1];

ネストしたArray

const hoge = [
  {foo: 'aaaa'},
  {foo: 'bbbb'}
]
const hoge: Array<{foo: string}>;

boolean

const hoge: boolean = true;

string

const hoge: string = 'aaaaa';

React

inputのonChangeのevent

onChange={(event: React.ChangeEvent<HTMLInputElement>) => {}}

style

style?: React.CSSProperties;

参考

any型で諦めない React.EventCallback – Qiita