Skip to content

build: prepare for TS 7 by enabling stableTypeOrdering compiler option - #5214

Open
trevorade wants to merge 1 commit into
ngrx:mainfrom
trevorade:stable-type-ordering
Open

build: prepare for TS 7 by enabling stableTypeOrdering compiler option#5214
trevorade wants to merge 1 commit into
ngrx:mainfrom
trevorade:stable-type-ordering

Conversation

@trevorade

Copy link
Copy Markdown

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.

  • 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.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[x] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

stableTypeOrdering is not enabled in TypeScript compiler options. When strict or stable type ordering is enforced, calls to createMockStore(), TestBed.inject(MockStore), and injector.get(MockStore) infer MockStore<unknown> instead of the parameterized state type, resulting in type assignment errors in testing utilities and test suites.

What is the new behavior?

  • Enables "stableTypeOrdering": true in tsconfig.json.
  • Adds explicit generic return typing (injector.get<MockStore<T>>(MockStore)) to createMockStore().
  • Adds explicit generic state types to TestBed.inject and injector.get calls in modules/store/testing/spec/mock_store.spec.ts and projects/example-app container specs.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Verified by running full build and test suites with --stableTypeOrdering=true across all packages.

- 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.
@netlify

netlify Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploy Preview for ngrx-io ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e944e4b
🔍 Latest deploy log https://app.netlify.com/projects/ngrx-io/deploys/6a8ccd58812cbc0008cbf2c7
😎 Deploy Preview https://deploy-preview-5214--ngrx-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@trevorade

Copy link
Copy Markdown
Author

Do I need to do anything to request a reviewer for this PR?

@timdeschryver timdeschryver left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@trevorade

Copy link
Copy Markdown
Author

Thanks @timdeschryver! Can you please merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants