Need help understanding stream type syntax

Im working on porting a flow type generator that comes with a library ( Relay ) that generates TypeScript types but there are some questions about the Flow syntax that is not clear to me in this fragment :

import type { FragmentReference } from 'relay-runtime';
export opaque type TypenameInside$ref: FragmentReference = FragmentReference;
export type TypenameInside = ({|
  +__typename: 'User',
  +firstName: ?string,
  +$refType: TypenameInside$ref,
|} | {|
  +__typename: 'Page',
  +username: ?string,
  +$refType: TypenameInside$ref,
|} | {|
  // This will never be '%other', but we need some
  // value in case none of the concrete values match.
  +__typename: '%other',
  +$refType: TypenameInside$ref,
|});

Namely, what is $ref, $refTypeand %other? Or are they not flow specific, but rather relay specific?

I tried looking for documents and a stream stream repo, but it was very difficult for me to find the answers. Links to documents and / or relevant parts of the implementation will also be very useful.

+4
source share
1 answer

$ref, $refTypeetc. are normal type names.

$ - , , $Keys, , .

%other - . , , - .

+4

Source: https://habr.com/ru/post/1691455/


All Articles