-
Notifications
You must be signed in to change notification settings - Fork 343
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
fix(akita): support TS strict mode #1050
fix(akita): support TS strict mode #1050
Conversation
Thanks for the contribution! Before we can merge this, we need @Den-dp to sign the Salesforce.com Contributor License Agreement. |
2560e45
to
682f66e
Compare
@Den-dp do you have any idea why the PR build fails? When I run |
@qnku thanks for your interest! TL;DR: CI fails cause of nx-related misconfiguration, so not really relevant (also I already have a fix ✔️ for that) Where I need some help is in testing these changes on a real code with a strict mode enabled 😉 It's relatively simple: # build akita and pack it
npx nx build akita
cd dist/packages/akita
npm pack
# install it in your project using full path to the datorama-akita-8.0.0.tgz
npm i C:\github\akita\dist\packages\akita\datorama-akita-8.0.0.tgz But if you are really interested in "why it works on your machine and doesn't on CI" then here are my findings:
|
@Den-dp Thanks for the quick update. We have a medium sized application and use the stores almost everywhere. I can confirm that the build errors we previously got with the 8.0.0 release and Angular 15 do not occur anymore with your fix. Also found no runtime errors during my tests (which I didn't expect anyway, since you just changed the typings). For the test I used your installation instruction, turned Very happy, hoping for a release soon :-) |
Hey @Den-dp, thanks for the effort 👍 I have tested your changes in an Angular 15 project with strict mode enabled. No more type/compilation errors. My stores of type Perhaps the CI/CD/build problem should be addressed in a different issue/PR. That's probably not directly related to the strict mode issue. Do you want to remove the draft state of this PR and ping Netanel? |
This PR makes the public API of Akita to be consumable in a strict typescript project Refs: salesforce#870
682f66e
to
fb1aa61
Compare
Thanks for your help @qnku @nunoarruda! I've converted this Draft into PR, updated the description with your feedback, and also provided a CI fix. Initially, I wanted to find out what is the best way to repro the issue using this repo, so that acceptance criteria for #870 would be more straightforward and obvious. The only solution I came up with is to convert the But the |
Add `dependsOn` for `build` to build dependencies of a project first before building the project Remove "nx/presets/npm.json" to fix deps graph (cause it disabled the analyzeSourceFiles feature)
fb1aa61
to
5610f55
Compare
This PR makes the public API of Akita to be consumable in a strict typescript project (and without skipLibCheck).
Refs: #870
The first thing I've tried is to enable
strict: true
for this monorepo and fix them - but the amount of errors in such case is pretty significant 🥵After that, I tried to fix only TS errors that I found while consuming akita@8.0.0 in my project. And such approach helped me to decrease the API surface to a couple of places, which was somehow fixed in this draft/spike #1050.
Interestingly, #1050 already allowed me to consume akita in Angular 15 project with a strict mode (and without skipLibCheck).
But unfortunately:
1. I'm not confident in these TS-related changes (don't have a big project to test on)UPD: @qnku @nunoarruda confirmed that it works for them
2. I want to find a proper tsconfig configuration that will help with the reproduction of the initial issue for future contributorsUPD: I'm thinking of converting
ng-playground
into strict mode and switching it to consume a lib fromdist
(the last one does not oblige us to fix all akita strict issues but only d.ts related) as a separate PRBut any recommendations on these 2 subjects are welcome!
Also, I'm totally ok if someone wants to use my spike to fix this issue ❤️