Skip to content

Commit e940cb8

Browse files
committed
chore: resolve conversation
1 parent 57d4c82 commit e940cb8

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

test/component.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ Component({
418418
},
419419
})
420420

421-
Component<{}, {}, { fn(): void }>({
421+
Component<{}, {}, { fn(): void }, []>({
422422
methods: {
423423
fn() {
424424
expectError(this.notExists)

test/computed.test.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ declare namespace WechatMiniprogram {
2323
CustomProperty extends IAnyObject = Record<string, never>,
2424
> = Partial<Computed<C>> &
2525
ThisType<ComputedInstance<D, P, M, C, CustomProperty>> &
26-
Options<D, P, M>
26+
Options<D, P, M, []>
2727
interface ComputedConstructor {
2828
<
2929
D extends DataOption,

test/issue.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ wx.request({
174174
f?: () => string
175175
g: () => void
176176
}
177-
type Dialog = WechatMiniprogram.Component.Instance<{}, {}, IDialogMethod>
177+
type Dialog = WechatMiniprogram.Component.Instance<{}, {}, IDialogMethod, []>
178178
Page({
179179
f() {
180180
const comp = this.selectComponent('#comp') as Dialog

types/wx/lib.wx.behavior.d.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,28 @@ SOFTWARE.
2121
***************************************************************************** */
2222

2323
declare namespace WechatMiniprogram.Behavior {
24-
type RealBehaviorType<
24+
25+
type BehaviorIdentifier<
2526
TData extends DataOption = {},
2627
TProperty extends PropertyOption = {},
2728
TMethod extends MethodOption = {},
2829
TBehavior extends BehaviorOption = []
29-
> = {
30+
> = string & {
3031
[key in 'BehaviorType']?: {
3132
data: TData & Component.MixinData<TBehavior>
3233
properties: TProperty & Component.MixinProperties<TBehavior, true>
3334
methods: TMethod & Component.MixinMethods<TBehavior>
3435
}
3536
}
36-
37-
type BehaviorIdentifier = string
3837
type Instance<
3938
TData extends DataOption,
4039
TProperty extends PropertyOption,
4140
TMethod extends MethodOption,
4241
TBehavior extends BehaviorOption,
4342
TCustomInstanceProperty extends IAnyObject = Record<string, never>
4443
> = Component.Instance<TData, TProperty, TMethod, TBehavior, TCustomInstanceProperty>
45-
type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject, Component.IAnyArray>
46-
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, Component.IAnyArray>
44+
type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject, Component.IEmptyArray>
45+
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, Component.IEmptyArray>
4746
type Options<
4847
TData extends DataOption,
4948
TProperty extends PropertyOption,
@@ -66,7 +65,7 @@ declare namespace WechatMiniprogram.Behavior {
6665
TCustomInstanceProperty extends IAnyObject = Record<string, never>
6766
>(
6867
options: Options<TData, TProperty, TMethod, TBehavior, TCustomInstanceProperty>
69-
): BehaviorIdentifier & RealBehaviorType<TData, TProperty, TMethod, TBehavior>
68+
): BehaviorIdentifier<TData, TProperty, TMethod, TBehavior>
7069
}
7170

7271
type DataOption = Component.DataOption

types/wx/lib.wx.component.d.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare namespace WechatMiniprogram.Component {
2626
TData extends DataOption,
2727
TProperty extends PropertyOption,
2828
TMethod extends Partial<MethodOption>,
29-
TBehavior extends BehaviorOption = [],
29+
TBehavior extends BehaviorOption,
3030
TCustomInstanceProperty extends IAnyObject = {},
3131
TIsPage extends boolean = false
3232
> = InstanceProperties &
@@ -35,27 +35,28 @@ declare namespace WechatMiniprogram.Component {
3535
MixinMethods<TBehavior> &
3636
(TIsPage extends true ? Page.ILifetime : {}) &
3737
Omit<TCustomInstanceProperty, 'properties' | 'methods' | 'data'> & {
38+
/** 组件数据,**包括内部数据和属性值** */
3839
data: TData & MixinData<TBehavior> &
3940
MixinProperties<TBehavior> & PropertyOptionToData<FilterUnknownProperty<TProperty>>
4041
/** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */
4142
properties: TData & MixinData<TBehavior> &
4243
MixinProperties<TBehavior> & PropertyOptionToData<FilterUnknownProperty<TProperty>>
4344
}
4445

45-
type IAnyArray = []
46+
type IEmptyArray = []
4647
type TrivialInstance = Instance<
4748
IAnyObject,
4849
IAnyObject,
4950
IAnyObject,
50-
IAnyArray,
51+
IEmptyArray,
5152
IAnyObject
5253
>
53-
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, IAnyArray, IAnyObject>
54+
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, IEmptyArray, IAnyObject>
5455
type Options<
5556
TData extends DataOption,
5657
TProperty extends PropertyOption,
5758
TMethod extends MethodOption,
58-
TBehavior extends BehaviorOption = [],
59+
TBehavior extends BehaviorOption,
5960
TCustomInstanceProperty extends IAnyObject = {},
6061
TIsPage extends boolean = false
6162
> = Partial<Data<TData>> &
@@ -79,7 +80,7 @@ declare namespace WechatMiniprogram.Component {
7980
TData extends DataOption,
8081
TProperty extends PropertyOption,
8182
TMethod extends MethodOption,
82-
TBehavior extends BehaviorOption = [],
83+
TBehavior extends BehaviorOption,
8384
TCustomInstanceProperty extends IAnyObject = {},
8485
TIsPage extends boolean = false
8586
>(

0 commit comments

Comments
 (0)