layout: narrow keyed field parts.control by widget (#176) - #177
Open
timkindberg wants to merge 1 commit into
Open
layout: narrow keyed field parts.control by widget (#176)#177timkindberg wants to merge 1 commit into
timkindberg wants to merge 1 commit into
Conversation
`layout`'s FormShape-keyed field handles returned a plain `EField`, so
`<Default of={root.children.username} parts={{ control }} />` still forced
a `c.kind` guard even though the brand already knew the widget.
`LayoutNode`'s field branch is now `LayoutField`, an `EField` whose
`parts.control` is `Extract`ed to `ControlForWidget<TS['fields'][Path]['widget']>`
— the same archetype the typed-rules door hands `FieldProps`. The floor keeps
the union (a function intercept fires for every node and cannot know more,
ADR 029 §5); unbranded trees keep `AnyKindNode`. Widget overrides re-narrow
for free through the brand `useFormTree` already threads.
Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Reaching a field through
layout's keyed door still made you write ac.kindguard, even though the brand already knew the widget. Found this while reviewing #174.LayoutNode's field branch is a newLayoutField— anEFieldwithparts.controlExtracted down toControlForWidget<TS['fields'][Path]['widget']>ControlOverrideOfalready preferred a handle's liveparts.controlover Core's widePartsOverrides, so nothing else needed wiringuseFormTreealready re-brandsformthroughApplyWidgetOverridesparts.control, with a@ts-expect-errorproving the narrowing. Four existing layout assertions moved totoExtendsince the handle is a subtype nowThe function intercept door keeps the full union on purpose — it fires for every node so it genuinely can't know more (ADR 029 §5). Unbranded trees keep
AnyKindNode.npm run gategreen.Closes #176