Skip to content

Commit

Permalink
fix(types): more public type argument order fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 6, 2023
1 parent 88487a5 commit 9435daf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
11 changes: 7 additions & 4 deletions packages/runtime-core/src/apiDefineComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ export type DefineComponent<
Mixin,
Extends,
E,
S,
PP & Props,
Defaults,
true
true,
{},
S
> &
Props
> &
Expand All @@ -82,8 +83,10 @@ export type DefineComponent<
Extends,
E,
EE,
S,
Defaults
Defaults,
{},
string,
S
> &
PP

Expand Down
28 changes: 14 additions & 14 deletions packages/runtime-core/src/componentOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ export interface ComponentOptionsBase<
Extends extends ComponentOptionsMixin,
E extends EmitsOptions,
EE extends string = string,
S extends SlotsType = {},
Defaults = {},
I extends ComponentInjectOptions = {},
II extends string = string
II extends string = string,
S extends SlotsType = {}
> extends LegacyOptions<Props, D, C, M, Mixin, Extends, I, II>,
ComponentInternalOptions,
ComponentCustomOptions {
Expand Down Expand Up @@ -233,10 +233,10 @@ export type ComponentOptionsWithoutProps<
Extends,
E,
EE,
S,
{},
I,
II
II,
S
> & {
props?: undefined
} & ThisType<
Expand All @@ -249,11 +249,11 @@ export type ComponentOptionsWithoutProps<
Mixin,
Extends,
E,
S,
PE,
{},
false,
I
I,
S
>
>

Expand Down Expand Up @@ -281,10 +281,10 @@ export type ComponentOptionsWithArrayProps<
Extends,
E,
EE,
S,
{},
I,
II
II,
S
> & {
props: PropNames[]
} & ThisType<
Expand All @@ -297,11 +297,11 @@ export type ComponentOptionsWithArrayProps<
Mixin,
Extends,
E,
S,
Props,
{},
false,
I
I,
S
>
>

Expand Down Expand Up @@ -330,10 +330,10 @@ export type ComponentOptionsWithObjectProps<
Extends,
E,
EE,
S,
Defaults,
I,
II
II,
S
> & {
props: PropsOptions & ThisType<void>
} & ThisType<
Expand All @@ -346,11 +346,11 @@ export type ComponentOptionsWithObjectProps<
Mixin,
Extends,
E,
S,
Props,
Defaults,
false,
I
I,
S
>
>

Expand Down
22 changes: 19 additions & 3 deletions packages/runtime-core/src/componentPublicInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ type MixinToOptionTypes<T> = T extends ComponentOptionsBase<
infer Extends,
any,
any,
infer Defaults,
any,
infer Defaults
any,
any
>
? OptionTypesType<P & {}, B & {}, D & {}, C & {}, M & {}, Defaults & {}> &
IntersectionMixin<Mixin> &
Expand Down Expand Up @@ -142,11 +144,11 @@ export type CreateComponentPublicInstance<
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
E extends EmitsOptions = {},
S extends SlotsType = {},
PublicProps = P,
Defaults = {},
MakeDefaultsOptional extends boolean = false,
I extends ComponentInjectOptions = {},
S extends SlotsType = {},
PublicMixin = IntersectionMixin<Mixin> & IntersectionMixin<Extends>,
PublicP = UnwrapMixinsType<PublicMixin, 'P'> & EnsureNonVoid<P>,
PublicB = UnwrapMixinsType<PublicMixin, 'B'> & EnsureNonVoid<B>,
Expand All @@ -167,7 +169,21 @@ export type CreateComponentPublicInstance<
PublicProps,
PublicDefaults,
MakeDefaultsOptional,
ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E, string, S, Defaults>,
ComponentOptionsBase<
P,
B,
D,
C,
M,
Mixin,
Extends,
E,
string,
Defaults,
{},
string,
S
>,
I,
S
>
Expand Down

0 comments on commit 9435daf

Please sign in to comment.