wechat-miniprogram / wechat-miniprogram/api-typings

[feat] wx.component.d.ts 可以支持自定义根属性扩展

Open
#173 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
803
Forks
117
Avg merge
24m
Merged PRs (30d)
1

Description

我给 component options里扩展了一个属性选项computed,我需要给它编写类型定义, 场景:

Component({
    computed: {
        sum(data) {
            return 1;
        }
    }
});

但是发现并没有提供相关扩展:
https://github.com/wechat-miniprogram/api-typings/blob/c7fb54c1274f2827aa7852071a4a1813aa9fcea2/types/wx/lib.wx.component.d.ts#L47
但是Page是提供了CustomOption来方便用户进行自定义属性值或者函数扩展的:
https://github.com/wechat-miniprogram/api-typings/blob/c7fb54c1274f2827aa7852071a4a1813aa9fcea2/types/wx/lib.wx.page.d.ts#L39

希望能和Page一样提供一下自定义扩展类型

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in types/wx/lib.wx.component.d.ts at the component options definition, then compare the CustomOption pattern in types/wx/lib.wx.page.d.ts. Add the corresponding custom root-property extension for components, and verify that the shown computed option is accepted by the TypeScript definitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.