wechat-miniprogram / wechat-miniprogram/api-typings

After passing generics to Component, the methods cannot automatically infer the function types and default to Function

Open
#329 1 comment 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

/**
 * 页面中参与渲染的数据
 */
type ComponentData = typeof DEFAULT_DATA

/**
 * 页面中的方法
 */
interface ComponentMethods extends WechatMiniprogram.Component.MethodOption {}

/**
 * 页面的静态实例
 */
interface ComponentInstanceProperty {
  $unbindDialog?: WechatMiniprogram.Component.TrivialInstance
}

Component<ComponentData, {}, ComponentMethods, ComponentInstanceProperty, true>

image
image

Does the official source have more recommended practices?

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

No repository file or test is named. Start by reproducing the generic Component usage shown in the issue and inspect the relevant TypeScript definitions for method inference. Compare the inferred method types with the expected function types; done means the inference problem or the officially recommended usage is clearly documented or addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.