[Vuejs]-PropTyped prop is of type unknow

0👍

You need to define the type for the props parameter. E.g.:

interface Props {
  icon: {
    icon: PropType<IconType>;
    required: boolean;
  }
}

Then you can use it in the setup code:

setup (props: Props) {

Further explanation: The props object that you have written directly below export default defineComponent({ is used by Vue to define valid input properties for the component, however you need the above for TypeScript to infer their types.

Leave a comment