Skip to content

Commit

Permalink
fix: issue with vue default props
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Jan 16, 2025
1 parent af767e2 commit d976239
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useDefaultProps, useStore } from '@builder.io/mitosis';
import { DefaultPropsState, DefaultPropsType } from './types';

useDefaultProps<DefaultPropsType>({ foo: 'abc', bar: 'foo' });
useDefaultProps({ foo: 'abc', bar: 'foo' });

export default function DefaultProps(props: DefaultPropsType) {
const state = useStore<DefaultPropsState>({
export default function DefaultProps(props: any) {
const state = useStore({
getProps: () => {
return JSON.stringify({ foo: props.foo, bar: props.bar });
},
Expand Down
8 changes: 0 additions & 8 deletions e2e/e2e-app/src/components/default-props/types.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/core/src/generators/vue/compositionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getCompositionPropDefinition = ({
let str = 'const props = ';

if (component.defaultProps) {
const generic = isTs ? `<${component.propsTypeRef}>` : '';
const generic = isTs && component.propsTypeRef !== 'any' ? `<${component.propsTypeRef}>` : '';
const defalutPropsString = props
.map((prop) => {
const value = component.defaultProps!.hasOwnProperty(prop)
Expand Down

0 comments on commit d976239

Please sign in to comment.