Flow Typecast Comments
See original GitHub issueIn flow, you can typecast with the following,
(obj: Class).property
You can also do this with comments,
(obj /*: Class */).property
However, this gets transformed into,
obj /*: Class */.property
Both are syntactically valid, but only one is recognised by flow. Maybe we’d just want to check comments that start with :
?
Happy to help if you decide what direction we should go!
Edit
Also,
const x = (input /*: string */) /*: string */ => {};
// to
const x = (input /*: string */ /*: string */) => {};
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:30 (19 by maintainers)
Top Results From Across the Web
Type Casting Expressions | Flow
Using type cast expressions you can assert that values are certain types. ... Asserting types in this way works the same as types...
Read more >How can Flow be forced to cast a value to another type?
Flow doesn't do direct casting from one type to another, but you can do ... It's important to note that both suppression comments...
Read more >Type annotations in comments? #3 - facebook/flow - GitHub
Comments are kind of a parsing nightmare. Knowing which node a comment belongs to is a Hard Problem, and often is solved by...
Read more >Convert text to number - Power Platform Community - Microsoft
Yes, there is a way to convert it into Number in Microsoft Flow. An easy way for you to manage,. 1. Add one...
Read more >What I wish I had known before starting to use Flow
Since TypeScript and Flow have very similar syntaxes, I somewhat expected ... due to implicit casting (Flow has an explicit type system).
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We now have a much better infrastructure for dealing with comments so we should be able to fix all the issues reported here 😃
Any update on this one?
Flow comment-style annotations are still being moved from outside to inside the parens on arrow functions for me. I’m using Prettier 1.7.0.