Skip to content

Regression in connect from @types/react-redux@7.0.2 allows any props #36873

@mikew

Description

@mikew

If you do not mention the authors the issue will be ignored.


I can't pinpoint the commit / change that introduced the regression, just the version. Versions after 7.0.1 will seemingly allow any props, even ones with the wrong type.

Repro:

import React from 'react'
import { connect } from 'react-redux'

interface Props {
  title: string
}

const Example = (props: Props) => <div>{props.title}</div>
const ExampleConnected = connect()(Example)

const ThisShouldNotCompile = () => (
  <div>
    {/* This errors, as it should. */}
    <Example />
    {/* Yet this happily compiles. */}
    <ExampleConnected />
  </div>
)

Versions before 7.0.2 will show an error for both elements in ThisShouldNotCompile.

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