-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
Sometimes I have two types, and both of them are numbers, for instance, but at the same time have absolutely different meaning. Can I express this in Flow? I tried type aliases, but they are simply interpreted as the types they alias, so this code type checks:
/* @flow */
type UserId = number;
type NumberOfFollowers = number;
function hasLotOfFollowers(followers: NumberOfFollowers): boolean {
return followers > 1000;
}
var userId: UserId = 100;
// Expecting error here
hasLotOfFollowers(userId);$ flow
No errors!
Reactions are currently unavailable