feat: implement TypeGen support#210
Conversation
🦋 Changeset detectedLatest commit: a4e1a37 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…onents, and InferValue utility types Agent-Logs-Url: https://github.com/portabletext/to-html/sessions/1cd83452-eb66-48b4-a3a4-55c9955100c5 Co-authored-by: stipsan <81981+stipsan@users.noreply.github.com>
0e05082 to
5b2c709
Compare
stipsan
left a comment
There was a problem hiding this comment.
@copilot no no, I want you to setup the same exact testing suite https://github.com/portabletext/react-portabletext/tree/d15decca09351dcef693373746d31bacf052d3dd/test/typegen where the only difference is that instead of assertions with react like:
;<PortableText value={bio} components={components} />
you will be doing
toHTML(bio, {components})
Also, the release notes in your changeset/typegen-support.md should be exactly like https://github.com/portabletext/react-portabletext/blob/e59cacb5db777381517a19307512fdb12ce61c9e/.changeset/typegen-component-inference.md
…ct component types Agent-Logs-Url: https://github.com/portabletext/to-html/sessions/48258e6f-3eb8-48b4-bb5a-2e5b72216273 Co-authored-by: stipsan <81981+stipsan@users.noreply.github.com>
Done in a4e1a37. Set up the same exact test suite from |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Adds full Sanity TypeGen support, mirroring the approach from
@portabletext/react(PR #309). Purely type-level — zero runtime changes.Changes
PortableTextHtmlComponents<B>,PortableTextComponents<B>, andPortableTextOptions<B>now flowBfrom thevalueparameter through to component handlersRecord<string, ...>, no custom members → fallbackInferComponents<T>— forgiving component map inferred from value type (extra handlers allowed)InferStrictComponents<T>— strict mode requiring all custom handlers, rejecting unknown onesInferValue<T>— recursively extracts PT array item types from any TypeGen query resultDefaultPortableTextBlockStyle,DefaultPortableTextListItem,DefaultPortableTextMarkInferValueUsage
Backward compatible — all generics default to
any, so existing untyped usage is unchanged.