timkindberg / timkindberg/formframe
intercept path map: literal path keys should narrow parts.control by widget too
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 4
Description
The fourth door. #176 narrowed layout's keyed children; the path-map intercept has the same literal-key shape and still forces an annotation.
// App_16 — the key IS a literal path, but `ControlOverride<'input'>` is still
// required to say what the brand already knows.
const StreetControl: ControlOverride<'input'> = (c) => <input {...c.attrs} />
const customizeIntercept = { 'address.street': { control: StreetControl } }
InterceptMap is Record<string, InterceptMapValue> (intercept.ts) — it reads no brand at all, so neither the path keys nor parts.control narrow. Updated door table:
| door | path keys | control type |
|---|---|---|
| function intercept | n/a | full union — correct, fires for every node |
useInterceptRules typed rules |
checked | narrowed by widget |
layout keyed children |
checked | narrowed by widget (#176) |
path-map / bag paths intercept |
string |
full union — the gap |
Bigger than #176 was: layout already received the brand through LayoutRoot<TreeShapeOf<F>>, so that fix was one type. Here the brand has to reach the intercept prop, which is typed Intercept on both SchemaFieldsProps and BoundSchemaFieldsProps with no TS parameter. Threading it also buys typo-checking on the keys ('adress.street' is silent today), which is arguably the bigger win.
Watch for: the map is also a runtime lowering (lowerInterceptMap), and unbranded trees must keep Record<string, …>. where predicates stay unnarrowed — they are the function door.
Found while reviewing #177. Related to ADR 051, ADR 048 §2.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in intercept.ts with InterceptMap and trace the Intercept prop through SchemaFieldsProps and BoundSchemaFieldsProps. Check lowerInterceptMap to preserve runtime lowering, while keeping unbranded trees as Record<string, …> and leaving where predicates unnarrowed. Done means literal path keys and parts.control narrow by widget and typoed keys are rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100