Skip to content

Instantly share code, notes, and snippets.

@garbles
Last active January 30, 2018 02:03
Show Gist options
  • Save garbles/ee9a70ab474de3bed83e092cbe796aff to your computer and use it in GitHub Desktop.
Save garbles/ee9a70ab474de3bed83e092cbe796aff to your computer and use it in GitHub Desktop.
import uuid from 'uuid-v4';
import {sample} from 'babel-plugin-transform-flow-to-gen/api';
import type {$Gen} from 'babel-plugin-transform-flow-to-gen/Gen';
// FYI,
// type $Gen<T, _U> = T;
type User = {
id: $Gen<string, uuid>, // $Gen only supports references to function calls
name: string
}
console.log(sampleOne(User()));
// { "id": "90d53f1a-c49c-4010-aeaa-68d52e56181f", "name": "pnxR" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment