Skip to content

Instantly share code, notes, and snippets.

@corocoto
Created July 31, 2020 11:53
Show Gist options
  • Select an option

  • Save corocoto/b8a91b3ce18fe7e8e5e393c63ec57145 to your computer and use it in GitHub Desktop.

Select an option

Save corocoto/b8a91b3ce18fe7e8e5e393c63ec57145 to your computer and use it in GitHub Desktop.
Flow | Generic
type GenericObject<T> = { key: T };
var numberT: GenericObject<number> = { key: 123 };
var stringT: GenericObject<string> = { key: "Preethi" };
var arrayT: GenericObject<Array<number>> = { key: [1, 2, 3] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment