Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test/issue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,4 +634,29 @@ import WX = WechatMiniprogram
},
}
})
}

// Page behaviors support
{
const b1 = Behavior({
properties: {
pA: String,
},
data: {
d1: '',
},
methods: {
methodA() {
return ['']
},
},
})
Page({
behaviors: [b1],
test() {
expectType<string[]>(this.methodA())
expectType<string>(this.data.pA)
expectType<string>(this.data.d1)
},
})
}
5 changes: 4 additions & 1 deletion types/wx/lib.wx.page.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ declare namespace WechatMiniprogram.Page {
> = OptionalInterface<ILifetime> &
InstanceProperties &
InstanceMethods<TData> &
Component.MixinMethods<TCustom['behaviors']> &
Data<TData> &
TCustom
TCustom & {
data: Component.MixinData<TCustom['behaviors']> & Component.MixinProperties<TCustom['behaviors']>
}
type Options<
TData extends DataOption,
TCustom extends CustomOption
Expand Down
Loading