[Vuejs]-Vue 3 Typescript not assignable to type β€˜[]β€˜

3πŸ‘

βœ…

In TypeScript, the type [] explicitly mean empty array/tuple.

type A = [];

const a: A = ['a'];
// Error -> Type '[string]' is not assignable to type '[]'

const a: A = [];
// No error

export default a;

Therefore, what you need to do is just explicitly set the return type with IssueType[] instead of [].

πŸ‘€yqlim

Leave a comment