Skip to content

Explicit type specification for component rendering <MyComponent<T> /> #7672

@retyui

Description

@retyui

Proposal

Now there is no possibility to explicitly specify the generic type for the component.

This syntax can solve the problem:

<MyComponent<T> />;

I can be rea

Use case

// @flow
import React from 'react';

class MyComponent<T> extends React.Component<{| +item: T |}>{  }

<MyComponent<number> item={1} />; // work good
<MyComponent<string> item={1} />; // error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions