Skip to content

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

@anran758

Description

@anran758
/**
 * 页面中参与渲染的数据
 */
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions