Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Support flowtype definition for flow-typed (WIP) #5027
This is a flowtype definition for Vue.js
Like a TypeScript, I would like to unite the way of providing these definition files.
I'm considering the below specs:
Hi @kazupon , thank you for this contribution.
I'm reporting my experience with integrating Flow with Vue. But I think this might be helpful to you.
Providing good typing experience would be very hard in flow. Mainly due to flow's inherent expressiveness:
Without this -type, we cannot define Vue's methods/data option. Without augmentation, we cannot extend Vue's option object (which is a practice quite common in Vue community). These two are simply deal breakers.
Arguably TypeScript definition file does not provide decent experience (for now, will be better after TS2.3). But TS definition serves as a basic ground for library authors like vue-class-component.
Sadly, class component like approach utilizes stage-1 decorator syntax, which flow just ignores now. This simply means flow-definition isn't needed.
Other typing approach like chain-api isn't doable in flow due to this-typing problem stated above.
Generally I would dare to say Flow is (naturally) React biased. It is very hard to integrate other frameworks with it...
@StreetStrider The definitions in the
As @HerringtonDarkholme explained, that is hard to do currently, without a possibilty to type
In light of
referenced this pull request
Nov 2, 2017
@kazupon what about providing partial
I know, that we can not extend existing library definitions, but still. I had some experiments to be able to annotate
Link to playground: https://flow.org/try/#0PTAEAEDMBsHsHcBQiCWA7ALgUwE6QIYDGWoAagK4kDeiooAJCgM4DKuAbrgFygBGssaFnxoA3LQaw0ACiydMPJhhzoA5gBpQhfNGi8iAax4AxcmkIYUUgJQ8RAT3EBfZOmx4iJClgAe9b6A0dPRKsDhYPADyvABWWBbOyITQ+ExMoACy9gDCsAC2AA5SWJigKIVCeSUY6d6a3n4BQQzMbDicOKAAvKAE0ExYEiEYYSQ9VC50Q1KgsvIYispqmtq6+oRGoKbmljaBEgCQq3qGc9XWEi5OQA
You can join me with my attempts here: https://github.com/sobolevn/vue-flow-typed