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

TSTypeReference does not emit for React.SFC #476

Closed
milesj opened this issue May 14, 2018 · 2 comments · Fixed by #540
Closed

TSTypeReference does not emit for React.SFC #476

milesj opened this issue May 14, 2018 · 2 comments · Fixed by #540

Comments

@milesj
Copy link

milesj commented May 14, 2018

What version of TypeScript are you using?

2.8.1

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

0.12.0

What code were you trying to parse?

export interface PriceProps {
  // Some props
}

export const Price: React.SFC<PriceProps> = function Price(props) {}

What did you expect to happen?

I'm trying to write a rule that verifies the generics in React.SFC are correct, however, the TSTypeReference for React.SFC is never emitted, so I'm unable to capture and and write a rule around it.

For example, this doesn't even log.

TSTypeReference(node) {
  console.log(node);
},

What happened?

Doesn't work.

@macklinu
Copy link

I'm wondering if this issue is related to what's blocking bradzacher/eslint-plugin-typescript#117.

@milesj
Copy link
Author

milesj commented May 23, 2018

Sounds like it. I've noticed that if I go up to the parent, I can see the TSTypeReference node correctly as a child. It just doesn't work when referencing it directly.

mysticatea added a commit that referenced this issue Nov 8, 2018
mysticatea added a commit that referenced this issue Nov 13, 2018
* Update: add proper scope analysis (fixes #535)

* add computed-properties-in-type fixture

* add computed-properties-in-interface fixture

* add function-overload fixture

* add method-overload fixture

* add class-properties fixture

* add decorators fixture

* update visitor-keys

* add declare-global fixture

* fix typo

* add test for typeof in array destructuring

* add namespace fixture

* add declare-module fixture

* fix crash

* add declare-function.ts fixture

* add abstract-class fixture

* add typeof-in-call-signature fixture

* add test for #416

* add test for #435

* add test for #437

* add test for #443

* add test for #459

* add test for #466

* add test for #471

* add test for #487

* add test for #535

* add test for #536

* add test for #476

* fix test to use `expect()`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants