Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't complain about an undefined type #5559

Closed
NameFILIP opened this issue Dec 22, 2017 · 2 comments
Closed

Doesn't complain about an undefined type #5559

NameFILIP opened this issue Dec 22, 2017 · 2 comments

Comments

@NameFILIP
Copy link

type A = A;

const a: A = {
  a: '1'
};

https://flow.org/try/#0C4TwDgpgBAglC8sDcAoFBjA9gOwM7CgEMAuWBKAbxSiNIHIBGOlAXySA

Context:
I extracted a type into a type definition:

type FieldName = $Keys<Fields>

and then did a Replace All for $Keys<Fields> with FieldName. This has changed the definition as well. Luckily it was caught in code review, but I was surprised that flow had not reported an error

@ghost
Copy link

ghost commented Dec 27, 2017

type A = A defines a generic with an "unknown" type. In your example, view the AST tab and look for "type": "GenericTypeAnnotation". Here's another example illustrating the behavior in question.

@SamChou19815
Copy link
Contributor

This now errors

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

No branches or pull requests

2 participants