Skip to content

fix(with-resource): preserve hasValue narrowing - #315

Merged
rainerhahnekamp merged 7 commits into
mainfrom
fix/with-resource/has-value
Aug 30, 2026
Merged

fix(with-resource): preserve hasValue narrowing#315
rainerhahnekamp merged 7 commits into
mainfrom
fix/with-resource/has-value

Conversation

@rainerhahnekamp

Copy link
Copy Markdown
Collaborator

Summary

  • model hasValue as a function property with an explicit generic receiver
  • preserve the concrete SignalStore type while narrowing value() to exclude undefined
  • turn the existing inferred-consumer type tests into positive narrowing assertions

Verification

  • full pre-commit verify:all (lint, test, and build for the library and demo)
  • focused TypeScript compilation confirms the three hasValue narrowing assertions; one unrelated existing AddressResolver.address fixture error remains

@michael-small michael-small left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This change seems great for unnamed resources, but it does not fix named resources.

Repro branch commit, with examples you can intelisense in a component HTML/TS as well as a purposely broken test: ngrx-toolkit/ngrx-toolkit@5b8cb34

@rainerhahnekamp

Copy link
Copy Markdown
Collaborator Author

@michael-small, thanks for your commit on the unnamed resources. I have added some docu about the why and if you approve, we can merge and relase v22

@michael-small michael-small left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@rainerhahnekamp
rainerhahnekamp merged commit e2a2065 into main Aug 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants