Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(types): defineComponent object format with no props type (#839)
  • Loading branch information
xiaoxiangmoe committed Nov 1, 2021
1 parent b59e864 commit 8a31c78
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/component/componentOptions.ts
Expand Up @@ -88,7 +88,7 @@ export type ComponentOptionsWithArrayProps<
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>

export type ComponentOptionsWithoutProps<
Props = unknown,
Props = {},
RawBindings = Data,
D = Data,
C extends ComputedOptions = {},
Expand Down
4 changes: 2 additions & 2 deletions src/component/defineComponent.ts
Expand Up @@ -17,8 +17,8 @@ export function defineComponent<
C extends ComputedOptions = {},
M extends MethodOptions = {}
>(
options: ComponentOptionsWithoutProps<unknown, RawBindings, D, C, M>
): VueProxy<unknown, RawBindings, D, C, M>
options: ComponentOptionsWithoutProps<{}, RawBindings, D, C, M>
): VueProxy<{}, RawBindings, D, C, M>

// overload 2: object format with array props declaration
// props inferred as { [key in PropNames]?: any }
Expand Down
2 changes: 1 addition & 1 deletion test/types/defineComponent.spec.ts
Expand Up @@ -137,7 +137,7 @@ describe('defineComponent', () => {
const App = defineComponent({
setup(props, ctx) {
isTypeEqual<SetupContext, typeof ctx>(true)
isTypeEqual<unknown, typeof props>(true)
isTypeEqual<{}, typeof props>(true)
return () => null
},
})
Expand Down

0 comments on commit 8a31c78

Please sign in to comment.