Flow: What is the meaning of * in Type<*> .

Created on 6 Jul 2016  Â·  6Comments  Â·  Source: facebook/flow

Is it a new feature in Flow? Looks like it imply that will resolve later with more detail codes ? (can not find information for * in docs, are there more details about it?like restrict, recommend style ... ).
Maybe should have a separate page in docs for polymorphic type. There are many behaviours changed over time.

Needs docs

Most helpful comment

"existential types" are (embarrassingly) undocumented on flowtype.org, but here's a great article about it: http://sitr.us/2015/05/31/advanced-features-in-flow.html#existential-types

All 6 comments

"existential types" are (embarrassingly) undocumented on flowtype.org, but here's a great article about it: http://sitr.us/2015/05/31/advanced-features-in-flow.html#existential-types

@mroch Thank you.

This Stack Overflow question asks the same thing, showing the need for this documentation: What is the use of asterisk (*) type in Flow and what is the equivalent of that in TypeScript?

The answer on that page would be a good start for the documentation.

Search keywords: asterisk, star

Hmm, it looks like existential types actually are documented now, on the Utility Types page: https://flow.org/en/docs/types/utilities/#toc-the-existential-type.

However, that section is difficult to find by searching due to its lack of searchable keywords. Searching the “Search docs” field for “*”, “asterisk”, or “star” doesn’t bring up the relevant section, nor does searching Google for “Flow type” with the same terms. Two independent improvements could help with this:

  • Reword the description of the * feature to include relevant keywords, so that search engines find it
  • Enhance the “Search docs” field in the Flow docs to understand punctuation

Not sure why this issue has been found. @roryokane 's suggestions do not seem to have been implemented and it has taken searching through this repo's issues to find info about what * does.

It would be great if the doc's search functionality showed info on * for search terms such as 'inference', '', '<>'.

Looks like 39968bcd1f5badccfd4303b2245a88203fa49377 deprecated * types and was released in version 0.72.0.

However, I see the docs still mention using _ when supplying type arguments to callables.

If you only want to specify some of the type arguments, you can use _ to let flow infer a type for you:

//@flow
class GenericClass<T, U, V>{}
const c = new GenericClass<_, number, _>()

Is _ not deprecated? Does that replace *? Or are those two different things?

Was this page helpful?
0 / 5 - 0 ratings