Skip to content

no-unused-prop-types: Crashes on indexable TypeScript prop declarations #2687

Closed
@taion

Description

@taion

This is an issue with #2661 that makes it crash in certain cases. cc @eltonio450

Consider something like https://astexplorer.net/#/gist/dea688bfbbfb2b2a2ffc3b4e293e0a01/63d1542090fe4a6545194562b88ffa34d7b22c83.

The interface body here consists of a TSPropertySignature and a TSIndexSignature. The foundDeclaredPropertiesList is thus not actually a list of declared properties: https://github.com/yannickcr/eslint-plugin-react/pull/2661/files#diff-3ed4052fa9471077711e82f482c3f819R304

When iterating through them, attempting to access tsPropertySignature.key.name on the index signature in https://github.com/yannickcr/eslint-plugin-react/pull/2661/files#diff-3ed4052fa9471077711e82f482c3f819R317 fails, because the index signature has no key property.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ljharb@taion@eltonio450

        Issue actions

          no-unused-prop-types: Crashes on indexable TypeScript prop declarations · Issue #2687 · jsx-eslint/eslint-plugin-react