[Vuejs]-Argument of type 'string' is not assignable to parameter of type 'never'. ts error exists even when using any

1👍

const selectedActivities = ref([]);

Since you havn’t given this a type, typescript has to infer it. It sees you passed in an array, but has no idea what should be inside that array, so it gives it the type never[]. Trying to check a never[] for a string does not work, because it doesn’t contain strings.

Instead, you need to specify what type of array this is:

const selectedActivities = ref<string[]>([]);

Or:

const selectedActivities = ref([] as string[]);

Leave a comment