feat: export WrappingSet and narrow SetFrom's return type to WrappingSet<T> - #92
Draft
jeswr wants to merge 1 commit into
Draft
feat: export WrappingSet and narrow SetFrom's return type to WrappingSet<T>#92jeswr wants to merge 1 commit into
jeswr wants to merge 1 commit into
Conversation
…Set<T> WrappingSet is the concrete type behind every set-mapped model property, but it was internal, so its type could not be named by consuming code and SetFrom.subjectPredicate could only advertise the plain Set<T> interface. - Export WrappingSet from mod.ts - Narrow SetFrom.subjectPredicate's return type from Set<T> to WrappingSet<T> (non-breaking: WrappingSet implements Set<T>) - Document the WrappingSet class and constructor - Test that set-mapped model properties are WrappingSet instances Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 6, 2026
Draft
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.
Makes
WrappingSetpart of the public API and lets the type system say so.WrappingSetis the concrete type behind every set-mapped model property, but it was internal: consuming code could not name the type, andSetFrom.subjectPredicatecould only advertise the plainSet<T>interface. This is a prerequisite for set-level features (e.g. the per-set change notifications explored in #73), which need the concrete class to be publicly nameable.Changes
src/mod.ts:export * from "./WrappingSet.js"src/mapping/SetFrom.ts: narrowsubjectPredicate's return type fromSet<T>toWrappingSet<T>. Non-breaking:WrappingSet<T> implements Set<T>, so every existing annotation (e.g. model properties typedSet<Child>) still type-checks; the runtime value is unchanged.src/WrappingSet.ts: class and constructor JSDoc (live-view semantics,SetFrom.subjectPredicateas the intended entry point, a paired turtle/ts example).test/unit/wrapping_set.test.ts: asserts a set-mapped model property is aninstanceof WrappingSet, and (at compile time, via the model'sWrappingSet<string>property type) that the narrowed return type is exposed through the package surface.Relationship to #73
Supersedes one slice of the #73 omnibus: the
SetFrom.subjectPredicatereturn-type narrowing and themod.tsWrappingSetexport (including the non-events portion of its WrappingSet JSDoc). The event-emission machinery itself (on/off, listener registry, notifying dataset) is intentionally not included here and remains for follow-up PRs.