TypeScript - 객체의 key 값에 유니온 타입 선언하기
객체의 key 값에 유니온 타입 선언하기
1 | type userInfoType = "name" | "age" | "address"; |
- “인덱스 시그니처 매개변수는 리터럴 타입이나 제네릭 타입이 될 수 없다.”는 에러가 발생했다.
- 매핑된 객체를 대신 사용하라고 알려준다.
해결방법
1 | type userInfoType = "name" | "age" | "address"; |
1 | type userInfoType = "name" | "age" | "address"; |
1 | type userInfoType = "name" | "age" | "address"; |
author.bio
author.job