I’ve created a component library in Vue3 using TypeScript based on this package. Among several other issues, the one I’m focusing on right now is trying to get prop suggestions to appear while using VSCode. I’ve built a similar library in React with TypeScript and props will be suggested in the JSX render function. Is this feature not available in Vue templates or am I doing something wrong?
Here’s some relevant code: (it’s not actually formatted like this, this forum’s text editor is removing some new lines and spaces for some reason)
Here is the content of the auto-generated types file. I’ve added more to it because I’m exporting multiple components and a types module. The types module works, the components work, but the props are not suggested in VSCode.
import { DefineComponent, Plugin } from 'vue';
declare const ComponentLibraryName: Exclude<Plugin['install'], undefined>;
export default ComponentLibraryName;
export const Modal: DefineComponent<ClTypes.ModalPropsType, {}, any>;
export const Button: DefineComponent<ClTypes.ButtonPropsType, {}, any>;
export module ClTypes {
type ModalType =
'confirmAction' |
'confirmDelete' |
'confirmSuccess' |
'confirmInfo' |
'generic'
interface ModalSettingsType {
// An empty object is allowed, which closes the modal
// See App.tsx
modalType?: ModalType
title?: string
message?: string
buttons?: any
cancelable?: boolean
}
interface ModalPropsType {
dataTest?: string
settings: ModalSettingsType
close: () => void
}
interface ButtonPropsType {
dataTest?: string
disabled?: boolean
fontSize?: string
backgroundColor?: string
height?: string
width?: string
className?: string
title?: string
}
}