Skip to content

Instantly share code, notes, and snippets.

Gabriele Petronella gabro

View GitHub Profile
@gabro
gabro / validation.flow.js
Last active Feb 24, 2020
Dynamic object validation using $ObjMap in Flow
View validation.flow.js
/* @flow */
// A simplified representation of types using phantom types (so that we store the Type information both at value and type level)
class Type<T> {};
class StringT extends Type<string> {}
class NumberT extends Type<number> {}
// A schema for a User
const User = {
name: new StringT(),
You can’t perform that action at this time.