TypeScript React (TSX) component does not suggest props

I'm using TypeScript and React in IntelliJ IDEA 15.0.6. I have the TypeScript compiler turned on and tsconfig configured for React JSX. 

When I'm inside a JSX block I've found that IDEA does suggest components, but does not help at all with component props (attributes). 

For example, given this component definition:

```
    interface ButtonProps {
        label: string;
    }

    class Button extends React.Component<ButtonProps> { }
```

I would expect to get code completion suggestions for the `label` when writing a `<Button>` component in a JSX block:

```
    <Button label="Hello" />
```

But instead I get no suggestions on the `label` prop. This applies to all props on all components, including those from 3rd party libraries with proper typings. The TypeScript compiler does give me expected validation of the props at compile time.

Is there a way to to get code completion suggestions on React component props in a JSX block?

 

7 comments

Works fine for me in 2016.3 EAP:

 

please try upgrading Idea to the most recent version - React support in Idea 15 is very basic

0

I updated to IntelliJ 2016.2.3 and I get it for some components but many still do not. Does it support functional stateless components?

const HelloMessage = ({name, age}:HelloWorldProps) => {

}

0

May I revive the discussion?

Whereas the syntax const HelloMessage = ({name, age}:HelloWorldProps) works as expected now, the following syntax does not lead to Idea suggesting the props when using the component.

const HelloMessage: FunctionComponent<HelloWorldProps> = ({name, age, children}) =>
0

Please can you provide a complete code example? Can be related to https://youtrack.jetbrains.com/issue/WEB-37275 that is fixed in 2019.1

0

Elena, thank you for the quick response and the link!

It is exactly the same problem. Great news that it's been fixed.

Best regards,

Yan 

0

Please sign in to leave a comment.