
TS2322: Type Mgr[] | undefined is not assignable to type Mgr[]
Type undefined is not assignable to type Mgr[]
RightPanelHeader.tsx(70, 46): The expected type comes from property mgrList which is declared here on type IntrinsicAttributes & { mgrList: Mgr[]; }
TS18048: mgrList is possibly undefined
const TeamChangeButton = ({ mgrList }: { mgrList: Mgr[] }) => { ... }
mgrList가 항상 undefined 아님을 보장할 수 있다면→ 호출하는 쪽에서 안전하게 mgrList!로 non-null assertion 처리해줘 but, 확실할 때만 사용하기
<TeamChangeButton mgrList={mgrList!} />
mgrList가 undefined일 수도 있다면, 타입을 허용하고 기본값 설정const TeamChangeButton = ({ mgrList = [] }: { mgrList?: Mgr[] }) => { ... }
interface TeamChangeButtonProps { mgrList?: Mgr[]; }
const TeamChangeButton = ({ mgrList = [] }: TeamChangeButtonProps) => { ...}
방법 2로 하고, 화면 리턴되는 부분에서도 유무 값 확인 추가하여서 이슈 해결