-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 typescript 3.7 to emit declarations from js code, Use composite build #3805
Conversation
2a66894
to
9793413
Compare
6e11371
to
db1c33c
Compare
a715e66
to
e770f53
Compare
@Bnaya does this help with import discovery and props autocompletion in VS Code? Could you record a short demo of how this works? |
Hey Paul, |
@Bnaya could you publish generated declarations for |
you will find the recent code here: |
@Bnaya you've changed the typescript and makefile configurations completely, without explaining why. To me, it looks more like a fork than a contribution. If you actually want your code to be merged, please:
|
@fzaninotto This is not a fork at all, but somewhat refactor of some of the build, as expected from this kind of change. |
e770f53
to
5b1340a
Compare
I will add more info:
Using typescript composite build before 3.7 wasn't possible because it requires also emitting declarations. If this change of build is not acceptable on this time, i may try to just add declarations emit on a separate branch + pr without composite build |
Declarations only change done, See PR: #4375 |
At least your work could be useful and would save many man-hours instead of sitting here for four month. |
Thanks. As I said in #4375, the first step before publish types is to migrate the demo completely to TypeScript. that's because we want to be sure that the types we publish don't break existing TS apps. So if you want to help react-admin to have types, please start with the demo! |
I'm closing this PR is favor of moving discussion to #4375 |
Using composite project and the new ability of ts 3.7 of allowJs + declarations.
packages.
*
Typescript 3.7 is not released yet, but there are no errors.Maybe the merge should wait.
I'm really not sure how good the inferred declarations are.
symbols discoverability should be good, and that's a big plus,
but maybe using React components without clear props will confuse developers more than help them.
So we can choose to not ship the declarations inside the bundle.
Improving the types will not require full
ts
refactor, it can be done incrementally, using checkJs on the relevant package and adding typescript-jsdoc types.The entry point for all of the typescript programs is
tsconfig.build-all.all.json
That reference all of the inner tsconfigs, in cjs & esm variant.
means, cjs & esm are built as part of one big project. no need a separate invocation
Development workflow using:
Will give very efficient dev workflow, while watching the entire codebase, the
incremental
option makes you "pay" only for your changes.You may still run tsc --build -w on specific packages, without the need to build the packages it depends on before, as it will also build it for you as composite project.
The main thing that missing: build also esmSome of thejs
packages emitted d.ts are broken due to:microsoft/TypeScript#33626
run
yarn validate-emitted-declarations
to validate the emitted d.ts filesI think that as first step, it's better to shipping the emitted d.ts files for the js-based packages.I've added a workaround to emit valid d.ts, and also 33626 is expected to be fixed before 3.7 stable.