Skip to content

Commit 8a31c78

Browse files
authored
fix(types): defineComponent object format with no props type (#839)
1 parent b59e864 commit 8a31c78

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/component/componentOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export type ComponentOptionsWithArrayProps<
8888
} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M>>
8989

9090
export type ComponentOptionsWithoutProps<
91-
Props = unknown,
91+
Props = {},
9292
RawBindings = Data,
9393
D = Data,
9494
C extends ComputedOptions = {},

src/component/defineComponent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export function defineComponent<
1717
C extends ComputedOptions = {},
1818
M extends MethodOptions = {}
1919
>(
20-
options: ComponentOptionsWithoutProps<unknown, RawBindings, D, C, M>
21-
): VueProxy<unknown, RawBindings, D, C, M>
20+
options: ComponentOptionsWithoutProps<{}, RawBindings, D, C, M>
21+
): VueProxy<{}, RawBindings, D, C, M>
2222

2323
// overload 2: object format with array props declaration
2424
// props inferred as { [key in PropNames]?: any }

test/types/defineComponent.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ describe('defineComponent', () => {
137137
const App = defineComponent({
138138
setup(props, ctx) {
139139
isTypeEqual<SetupContext, typeof ctx>(true)
140-
isTypeEqual<unknown, typeof props>(true)
140+
isTypeEqual<{}, typeof props>(true)
141141
return () => null
142142
},
143143
})

0 commit comments

Comments
 (0)