facebook / fbjs

A collection of utility libraries used by other Meta JS projects.
MIT License
1.95k stars 313 forks source link

Wrong Flow type of joinClasses arguments #336

Open claudiopro opened 5 years ago

claudiopro commented 5 years ago

The Flow type of joinClasses arguments is mixed with arity 1, but in reality it is variadic as it accepts a list of strings. The most immediate fix I can think if is to change it to ...classNames: Array<mixed>

https://github.com/facebook/fbjs/blob/d308fa83c99c93e8e588de3396cf55b31e56b14e/packages/fbjs/src/core/joinClasses.js#L17

claudiopro commented 5 years ago

Found while debugging https://github.com/facebook/draft-js/issues/1988

zpao commented 5 years ago

Really we should bring out latest from www (for this and others) which has better types. To do everything starts to get pretty messy, I have some in progress work from a while back, tracking down what each of our projects was actually using and syncing minimal module.

function joinClasses(className?: ?string, ...classes: Array<?string>): string {
claudiopro commented 5 years ago

That's great to hear @zpao! What can I do to help?