build: prepare for TS 7 by enabling stableTypeOrdering compiler option - #5214
Open
trevorade wants to merge 1 commit into
Open
build: prepare for TS 7 by enabling stableTypeOrdering compiler option#5214trevorade wants to merge 1 commit into
trevorade wants to merge 1 commit into
Conversation
- Enable `stableTypeOrdering: true` in root `tsconfig.json` compiler options. - Add explicit generic type parameter to `injector.get<MockStore<T>>` in `createMockStore()`. - Add explicit generic state types to `TestBed.inject<MockStore<T>>` and `injector.get` calls in `modules/store/testing/spec/mock_store.spec.ts` and `projects/example-app` specs.
✅ Deploy Preview for ngrx-io ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Author
|
Do I need to do anything to request a reviewer for this PR? |
Author
|
Thanks @timdeschryver! Can you please merge this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TS7 changes type ordering to be stable. TS6 also implements this behavior behind the flag
--stableTypeOrdering. This commit enables the flag and resolves new type inference errors.stableTypeOrdering: truein roottsconfig.jsoncompiler options.injector.get<MockStore<T>>increateMockStore().TestBed.inject<MockStore<T>>andinjector.getcalls inmodules/store/testing/spec/mock_store.spec.tsandprojects/example-appspecs.PR Checklist
Please check if your PR fulfills the following requirements:
[ ] Tests for the changes have been added (for bug fixes / features)[ ] Documentation has been added / updated (for bug fixes / features)PR Type
What kind of change does this PR introduce?
What is the current behavior?
stableTypeOrderingis not enabled in TypeScript compiler options. When strict or stable type ordering is enforced, calls tocreateMockStore(),TestBed.inject(MockStore), andinjector.get(MockStore)inferMockStore<unknown>instead of the parameterized state type, resulting in type assignment errors in testing utilities and test suites.What is the new behavior?
"stableTypeOrdering": trueintsconfig.json.injector.get<MockStore<T>>(MockStore)) tocreateMockStore().TestBed.injectandinjector.getcalls inmodules/store/testing/spec/mock_store.spec.tsandprojects/example-appcontainer specs.Does this PR introduce a breaking change?
Other information
Verified by running full build and test suites with
--stableTypeOrdering=trueacross all packages.