question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Flow Typecast Comments

See original GitHub issue

In 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:30 (19 by maintainers)

github_iconTop GitHub Comments

12reactions
vjeuxcommented, Apr 23, 2017

We now have a much better infrastructure for dealing with comments so we should be able to fix all the issues reported here 😃

8reactions
brownieboycommented, Sep 16, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found