You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
They are incredibly easy, and powerful, in plain JavaScript. I encounter people from plain JS coming to TypeScript (in which class-factory mixins are possible) complaining that it is mind-boggling difficult to implement them with TypeScript.
In Flow, it is next to impossible, making this wonderful feature from JavaScript not usable in Flow.
import{BaseClass}from'somewhere'import{FooMixin}from'foo-lib'exportclassMyClassextendsFooMixin(BaseClass){myMethod(): boolean{returntrue}}consto=newMyClass()constb: boolean=o.myMethod()constn: number=o.fooMethod()// new method from FooMixin
This is incredibly useful for composition in plain JavaScript, yet in Flow it is next to impossible, and in TypeScript it is doable but still too complicated.
We need to be able to easily express plain JavaScript concepts. It is super clear to the human mind what the mixin does in plain JS.
I don't have time to implement this in Flow myself, but I hope someone can please seriously consider it because this feature of plain JavaScript is very useful for code re-use.
The text was updated successfully, but these errors were encountered:
Given all the pain of typing React HOC in the past, we know that typing things like this will be verbose at least. We do not intend to support this, because we don't have a goal to make all the code that runs fine type check and make you type the least number of characters.
Proposal
Can you please support class factory mixins?
They are incredibly easy, and powerful, in plain JavaScript. I encounter people from plain JS coming to TypeScript (in which class-factory mixins are possible) complaining that it is mind-boggling difficult to implement them with TypeScript.
In Flow, it is next to impossible, making this wonderful feature from JavaScript not usable in Flow.
Use case
The concept in JavaScript in incredibly simple:
and then use it, for example convert this code,
to this:
This is incredibly useful for composition in plain JavaScript, yet in Flow it is next to impossible, and in TypeScript it is doable but still too complicated.
We need to be able to easily express plain JavaScript concepts. It is super clear to the human mind what the mixin does in plain JS.
I don't have time to implement this in Flow myself, but I hope someone can please seriously consider it because this feature of plain JavaScript is very useful for code re-use.
The text was updated successfully, but these errors were encountered: