Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

interface not correctly parsed #327

Closed
boompig opened this issue Jun 14, 2017 · 2 comments
Closed

interface not correctly parsed #327

boompig opened this issue Jun 14, 2017 · 2 comments

Comments

@boompig
Copy link

boompig commented Jun 14, 2017

What version of TypeScript are you using?

2.4.0

What version of typescript-eslint-parser are you using?
3.0.0

What code were you trying to parse?

import { React } from "react";

interface Props {
    hello: string;
}

class TestView extends React.Component<Props, any> {
    render() {
        return (
            <span>{ this.props.hello }</span>
        );
    }
};

What did you expect to happen?

No errors

What happened?

3:11 error 'Props' is not defined no-undef
4:5 error 'hello' is not defined no-undef

✖ 2 problems (2 errors, 0 warnings)

Is this related to #75?

@soda0289
Copy link
Member

This is a duplicate of #179. For this to be fixed we need a way for the the scope analysis tool, used be eslint, to understand interfaces. We have some proposals for a possible solution just need to reach consensus on the next steps.

@JamesHenry
Copy link
Member

JamesHenry commented Jun 14, 2017

I think this is actually just a standard no-undef issue @soda0289, the import from React is not relevant to the linting failures. The interface is defined and then used within the same file.

@boompig Please see the known issues https://github.com/eslint/typescript-eslint-parser#known-issues, the easy way to resolve this is to use the TypeScript compiler itself to enforce no-undef behaviour. See my comment here for further info: #77 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants