-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to TypeScript #115
Conversation
flowts --no-allow-js --interactive-rename ./src
I don't mind this personally, I feel like we'd need buy-in from @goodmind (who is probably the most active contributor and user for flowgen) for this to get merged though 👍 |
This PR made me chuckle. Looks good, but I dont contribute anymore so I agree with Orta, lets wait for more input. |
Alright, I'll give it one more week and I'll merge 👍 |
have looked into exactly the same issue recently :) in general case - it does not look possible to implement this utilities in Flow(at least I have not figured yet how to do it) - but it is possible to make something which, I would consider "good enough" - check also, there are special cases where it can be handled in better way, instead of having helper utility - see here: zxbodya/flowts@ee982fb I did it outside of flowgen - in the experimental utility, which is based on babel ast transformation (just like flowts)… it is not yet finished: for practical use, currently - flowgen is better. as an option, if you are looking for quick way to fix utility types in generated code - it should be easy to extract utility types related logic, from repo I linked, into separate babel codemod and just run it after flowgen on generated code |
Thank you so much @zxbodya that is really helpful indeed. I was wondering if it is possible to completely replace these utility types with the result of them like:
What do you think about this idea? Btw. thank you for translating flowgen in TS 👍 |
Theoretically yes - I think, it should be possible to generate the result of applying But, I would suggest the approach should be different from what I did, and probably more complicated. Just babel ast - might not be enough to make it properly… Maybe using TypeScript compiler directly can help here (flowgen is probably better place to try doing it). The only issue, I am thinking about - it might result in a lot of generated code, in some cases, which might be harder to read when using the definitions… But generally, I think, this is a good idea - would be really interesting to see how it will work comparing to generic util types. |
OK, looks like goodmind has been pretty inactive all year - so let's not be blocked there. @zxbodya - if you get this mergeable, I'll merge it 👍🏻 |
merged the changes from master, updated dependencies except typescript - which looks to require additional changes(so better to have it separate from this) |
Cool, works for me 👍🏻 |
This might look a bit weird, considering this is one of the most important tools in the Flow community…
But, I believe, considering, a large part of
flowgen
is actually based on TypeScript - this makes a lot of sense.Some background: did this mostly to make it easier to explore
flowgen
codebase for me, but I think this might be helpful to move for project in general.Changes in PR:
@ts-expect-errors
with todo comments to maketsc
happy (avoided doing much refactor - I think, this is better to be done separately, also I am not yet very familiar with TypeScript compiler API, to see how to better use it)