LoginSignup
0
0

More than 1 year has passed since last update.

TypeScriptのタイプ定義のTips1

Posted at
type Keys = 'option1' | 'option2';
type Flags1 = { [K in Keys]: boolean };
// Flags1はFlags2と等しい
type Flags2 = { option1: boolean; option2: boolean;}

let key = 'name'
let obj={key:'jack'} =>{key:jack}
// [key]:変数keyの値を読み取る
let obj={[key]:'jack'} =>{name:jack}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0