logo

The types of 'member.roles' are incompatible between these types. Type 'never[]' is not assignable to type '[]'. Target allows only 0 element(s) but source may have more.

* 관련 기술 스택이 없습니다
emoji

• InteractUseCaseDto라는 클래스를 생성하였고, 이 클래스는 body, rawBody, signature, timestamp 등의 속성을 가지고 있다.
• 테스트 코드에서 이 클래스를 mocking하기 위해 body에 값을 할당하였으나, 'Type 'never[]' is not assignable to type '[]'라는 에러가 발생하였다.
• 에러의 원인은 클래스에서 member의 roles 속성이 '[]'로 지정되어 있었기 때문이다.
• 이 문제는 배열 원소의 타입을 지정함으로써 해결할 수 있으며, 'roles: []'를 'roles: string[]'로 변경하면 된다.

thumbnail
북마크
공유하기
신고하기
1분 분량
조회수 124
profile-image아이들미연
일 년 전
Copyright © 2025. Codenary All Rights Reserved.