Skip to content

Commit 5a6b4d3

Browse files
committed
refactor(types): 优化泛型类型默认值为更明确的类型定义
1 parent ab45efd commit 5a6b4d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/simple-props/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export * from './types'
77

88
export function defineComponent<
99
T extends Record<any, any>,
10-
S extends Record<any, any> = {},
11-
M extends Record<any, any> = {},
10+
S extends Record<any, any> = { [key: string]: any },
11+
M extends Record<any, any> = { [key: string]: any },
1212
>(comp: FunctionalComponent<T, any, S>, extraOptions?: ComponentOptions): ComponentType<T, S, M> {
1313
const fn: FunctionalComponent = (_props, ctx) => {
1414
const props = useProps()

src/simple-props/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N
3232
export interface FunctionalComponent<
3333
P = {},
3434
E extends EmitsOptions | Record<string, any[]> = {},
35-
S extends Record<string, any> = any,
35+
S extends Record<string, any> = { [key: string]: any },
3636
EE extends EmitsOptions = ShortEmitsToObject<E>,
3737
> {
3838
(props: P & EmitsToProps<EE>, ctx: SetupContext<EE, IfAny<S, {}, SlotsType<S>>>): any

0 commit comments

Comments
 (0)