-
Notifications
You must be signed in to change notification settings - Fork 307
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
Use library-ts also for JS compilation #3420
Conversation
@alfonsogarciacaro Yes, it will be great to have .d.ts in |
Yes, when embedding the fable-library-ts files we can keep doing it the same way. The use case I've in mind is publishing fable-library, then you write a library in F# with the fable-library dependency and compile it to Typescript, then to .js + .d.ts for publishing. And finally you can consume it either from a JS or TS project. |
As commented above, finally this PR is giving up using I have added casts in several places to make things work. @ncave I have also included your code from #3411 in the tests to make sure it compiles with TypeScript, but it'd be great if you could add some actual assertions. |
@alfonsogarciacaro It's not my code actually, it's a heavily reduced repro sourced from FCS. |
c99d9e1
to
744b52c
Compare
It's not only the decision tree explosion, the code also gave me a chance to fix other typing issues (like casting non-ident expressions when accessing fields). But it's true it should be part of the integration tests. Although mocha has a timeout when running tests, maybe it's hit when the file takes too long to load. For now I've rebased the commit to add a simple assertion to make sure the code works. |
bcc4161
to
8f1962c
Compare
This unifies fable-library(-js) and fable-library-ts. The idea is to publish fable-library as JS but with .d.ts declarations to make sure F# code compiled both as JS and TS is compatible.
I ama having some trouble with the const enums for the union tags, so we may need to drop them and use plain ints again.