Associated functions and associated constants sound so yum! That's one thing I would love to have in Flowtype. But classes seem to serve that use case well enough.
class Test {
static value = 1;
static someStaticMethod = () => {
return 5;
}
}console.log(Test.value) // 1
console.log(Test.someStaticMethod()) // 5
Edit: Sorry, this actually a Stage 3 TC39 feature. Not sure if you can use it with flowtype (I think you can), but you might be able to if you enable babel with stage-3 features:
https://github.com/tc39/proposal-class-fields
You don't actually need this fancy class syntax anyway. You can just define a class and then do:
Test.value = 5
Test.someStaticMethod = () => { return 5; }
The class stuff is just sugar over the prototype stuff anyway, and a class is just a constructor function object with a prototype chain.
In the simple (not trait) case they just seem to be the same as "public static" constants and functions in C#, java etc.