Skip to content

[no-unused-vars] false positive when use imported type in JSX generic component #141

Closed
@claneo

Description

@claneo

Repro

{
  "rules": {
    "react/jsx-uses-vars": "error"
  },
  "plugins": [
    "react"
  ],
  "extends": "plugin:@typescript-eslint/recommended"
}
import React from 'react';
import { TypeA, TypeB } from './interface';

type TypeC = string;

class GenericComponent<P> extends React.Component {
    public internalProp: P;
}

export const a = <GenericComponent<TypeA> />;

export const b: TypeB = '';

export const c = <GenericComponent<TypeC> />;

Expected Result

no error

Actual Result

2:10 warning 'TypeA' is defined but never used @typescript-eslint/no-unused-vars

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 1.1.0
@typescript-eslint/parser 1.1.0
TypeScript 3.2.4
ESLint 5.12.1
node 10.14.1
npm 6.4.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpackage: parserIssues related to @typescript-eslint/parser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions