Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const MyComponent = component({
name: "MyComponentName",
props: {
foo: String,
bar: { type: Boolean, required: true }
},
setup(props, ctx) {
return () => <div class="{props.foo}">{ctx.slots.default()}</div>;
}
});
; // OK
; // OK
; //// TS2322 | TS2769: 'bar' is missing
const MyComponent2 = component({
props: {
foo: String
},
setup(
props,
ctx: SetupContext<{ onCutstomEvent: string }, { ss: boolean }, { customEvent: string }>
) {
const emitUpdate = updateEmitter();
const onClick = () => {
emit(ctx, "customEvent", "value");
emitOn(ctx, "onCutstomEvent", "value");
emit(ctx, "customEvent2", "value"); //// TS2345
emitOn(ctx, "onCutstomEvent2", "value"); //// TS2345
emit(ctx, "customEvent", 1); //// TS2345
import { component, SetupContext, emit, emitOn, updateEmitter } from "vue-tsx-support/lib/vca";
const MyComponent = component({
name: "MyComponentName",
props: {
foo: String,
bar: { type: Boolean, required: true }
},
setup(props, ctx) {
return () => <div class="{props.foo}">{ctx.slots.default()}</div>;
}
});
; // OK
; // OK
; //// TS2322 | TS2769: 'bar' is missing
const MyComponent2 = component({
props: {