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](https://cdn.jsdelivr.net/npm/emoji-datasource-twitter/img/twitter/64/1f605.png)
• InteractUseCaseDto라는 클래스를 생성하였고, 이 클래스는 body, rawBody, signature, timestamp 등의 속성을 가지고 있다.
• 테스트 코드에서 이 클래스를 mocking하기 위해 body에 값을 할당하였으나, 'Type 'never[]' is not assignable to type '[]'라는 에러가 발생하였다.
• 에러의 원인은 클래스에서 member의 roles 속성이 '[]'로 지정되어 있었기 때문이다.
• 이 문제는 배열 원소의 타입을 지정함으로써 해결할 수 있으며, 'roles: []'를 'roles: string[]'로 변경하면 된다.
![thumbnail](https://image.wanted.co.kr/optimize?src=https://static.codenary.co.kr/content_img/og_image/9199.png&w=480&q=95)
북마크
공유하기
신고하기