Cool article. I'm the author of https://github.com/codemix/babel-plugin-typecheck mentioned and the next version of the plugin (WIP) takes this kind of approach, so that you can reference a type at runtime:
type User = {name: string, isAdmin: boolean};
// compiles to
const User = t.object(
t.property('name', t.string()),
t.property('isAdmin', t.boolean())
);
// which you can then use with
User.check({name: 'Alice'}); // boolean
User.assert({nom: false}); // throws
Ultimately it should be possible to use this to implement pattern matching in JS based on flow types, for example:
type User = {
name: string;
roles: Role[];
};
type Role = {
id: number;
name: string;
users: User[]
};
const url = match(someInput,
(user: User) => `/users/${user.name}`,
(role: Role) => `/roles/${role.id}`,
(_) => `/` // default URL
);
The really hard thing is to do this whilst maintaining perfect compatibility with flow.
It's a full dress rehearsal, the only difference between static fire and a real launch is that they do not release the hold-down clamps and shut down the engines instead. The cameras would have been rolling.
It's not a random sequence of characters, there are only 12 words in there. The cracker is trying words, not just random bytes and so the search space is much smaller