Skip to content

Type of property is not inferred from base class #14684

Description

@Lenne231

TypeScript Version: 2.2.1

Is it possible to infer the type of state from the base class instead of being explicit?
This would be very useful for reactjs.

Code
image

Expected behavior:

state should be of type { tags: string[] }

Actual behavior:

state is of type { tags: any[] }

Activity

  1. Lenne231 commented on Mar 16, 2017

    @Lenne231
    Author
    class MyComponent extends Component<State> {
        state = { tags: [] }
    }
  2. RyanCavanaugh commented on Mar 16, 2017

    @RyanCavanaugh
    Member
  3. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions