I've hit a roadblock while attempting to integrate TypeScript into an existing Vue 2.6 project. Unfortunately, I'm required to stick with version 2.6 for legacy reasons. I've gone ahead and installed the composition API as a plugin.
The error I'm encountering is present in multiple components and presents itself in the following manner:
Parameter 'props' implicitly has an 'any' type.
Here is the code snippet that's causing the issue:
<script lang="ts">
import { reactive, computed } from "vue";
export default {
name: "Avatar",
props: {
title: {
type: String,
default: "my title",
},
alt: {
type: Boolean,
default: false,
},
size: {
type: String,
default: "regular",
},
},
setup(props) {
props = reactive(props);
return {
classes: computed(() => ({
avatar: props.title,
"avatar--alt": props.alt,
"avatar--small": props.size == "small",
})),
};
},
};
</script>
The error specifically arises on the line where setup(props) {
is declared.
While manually adding the type any
to props within the setup function removes the error, I understand that this is not the ideal solution. Can anyone provide suggestions or a proper solution to this dilemma?