Type of generic component #12242
Unanswered
AudunK
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So i have a component that has a v-model with number its type is then Component<{ modelValue: number }>. If i make this generic and has a v-model with T what is its type?
Example:
comp2 above gives error and i want to know its type. Goal is to not use Dummy3 but DummyGeneric
Type 'Raw<(<T>(__VLS_props: { readonly "onUpdate:modelValue"?: ((modelValue: T) => any) | undefined; modelValue: T; a?: T | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps, __VLS_ctx?: { ...; } | undefined, __VLS_expose?: ((exposed: ShallowUnwrapRef<...>) => void) | undefined, __VLS_setup?: Promis...' is not assignable to type 'Component<{ modelValue: any; }>'. Type 'Raw<(<T>(__VLS_props: { readonly "onUpdate:modelValue"?: ((modelValue: T) => any) | undefined; modelValue: T; a?: T | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps, __VLS_ctx?: { ...; } | undefined, __VLS_expose?: ((exposed: ShallowUnwrapRef<...>) => void) | undefined, __VLS_setup?: Promis...' is not assignable to type 'FunctionalComponent<{ modelValue: any; }, {}, any, {}>'. Types of parameters '__VLS_ctx' and 'ctx' are incompatible. Type 'Omit<{ attrs: Data; slots: Readonly<InternalSlots>; emit: (event: string, ...args: any[]) => void; expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed | undefined) => void; }, "expose">' is not assignable to type '{ slots: {}; attrs: any; emit: __VLS_ModelEmitsType; }'. Types of property 'emit' are incompatible. Type '(event: string, ...args: any[]) => void' is not assignable to type '__VLS_ModelEmitsType'.ts-plugin(2322)
Strange thing is it works in fiddle:
https://play.vuejs.org/#eNqlVG1v0zAQ/isnf1mRSopWkKaQFfEyIZCAaVR8ioRCeg3ZHCf4JWsV8t85O0nTVl0btnyJfff4/Nz5uavY26LwSoPMZ4GKZVpo4JFILkOmVchAoTbFLBRpVuRSQwVZJO9uovsxSFyOQa8LhPc5OQUKDTUsZZ7BGcU7e7059MFk2br1eBO3szfuI6a7kOkhzEcUKNN4F9kaO3wo4lwoDTHR8ntyAXHPF8h/RNygD5FYQz2Dyy6hUXPpMwrQHz//3/MtlT5KadGEomoFwmS/UMJfEIbz2ejiwsKCSVN1qnGgMSt4pJHWQF/gQjZr+/mWEj2M/YWst5fPHTHyuNs612RAmPOBcYLJFjc2Jm1Qess08W5VLkg6lYU2IVOO8luhU0o/ZD44j/VFnOf3n51NS4Pjzh7/xvjugP1WrawtZNcSFcqS+Gx8OpIJ6sZ99f0rrmi9cVIShhP6iPMGVc6N5djA3hmxINpbOMf2k1NeKpK5ulppFKpLyhK1yNrhqV4GrU4eSr2nO/VeunOhqKmKvc5PdF+jJfc6pKUFLlOBX+wuIBnORhXJ649JJS4aalCfUFbVahlqYrL/tvs9dYwbJA2OjPOQ0fmG27XMC0UNE73xYU5tMrJ8jqUxf0QSLcXTuQwfb26cVQ8PtN3sBg2YNvndafD0Fwzs5e7arcZO1fDp0MWZbAIdaPOfJUoreqre1HvlvWD1P5otE9c=
I use vite to build in vscode locally
Beta Was this translation helpful? Give feedback.
All reactions