Skip to content

Commit afb660b

Browse files
committed
docs(vscode-extension): the Export to React sample keeps its declared h1 node (objectui#11515)
`h1` is a declared type (`HtmlElementSchema`, objectui#8499), and `check-doc-component-types.test.ts` pins it in this very sample as the registered replacement for `heading`. With the constant annotated, the `h1` sample compiles against the built packages today and with objectui#11466 applied (measured with tsc and with check:doc-snippets on both trees), so the `text` / `variant: 'h1'` rewrite the card proposed is not needed and is reverted. The compile pin's documented sample follows. Claude-Session: https://claude.ai/code/session_01XvhGmGAP79ZB8swnkapxPC Co-authored-by: Claude <noreply@anthropic.com>
1 parent 71f9f2a commit afb660b

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎.changeset/11515-vscode-export-react-annotation.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Unannotated, every `type` in the constant widened to `string`. A `SchemaRenderer
88

99
`SchemaNode` was the annotation first proposed, and it does not fit: it also admits `number` and `boolean`, which the prop leaves out, so every generated file was refused at its one JSX line.
1010

11-
The compile pin gains a leg against the real prop type, read from `SchemaRenderer.tsx`, with a positive control. The two documented copies of the preamble (`DESIGN.md` and the docs page) follow it, and the docs page's sample authors a `text` node with its `h1` variant.
11+
The compile pin gains a leg against the real prop type, read from `SchemaRenderer.tsx`, with a positive control. The two documented copies of the preamble (`DESIGN.md` and the docs page) follow it. The docs page's sample keeps its `h1` node: `h1` is a declared type (`HtmlElementSchema`), and the annotated sample compiles both today and with objectui#11466 applied.

‎content/docs/utilities/vscode-extension.mdx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ const schema: SchemaRendererProps['schema'] = {
108108
"className": "p-4",
109109
"children": [
110110
{
111-
"type": "text",
112-
"variant": "h1",
113-
"content": "Hello World"
111+
"type": "h1",
112+
"children": "Hello World"
114113
}
115114
]
116115
};

‎packages/vscode-extension/src/__tests__/export-to-react-compiles.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,16 @@ describe('Export to React — the documented mirrors of the preamble (objectui#7
463463
const REACT_SCHEMA_RENDERER = join(REPO_ROOT, 'packages/react/src/SchemaRenderer.tsx');
464464
const TYPES_SOURCE_ENTRY = join(REPO_ROOT, 'packages/types/src/index.ts');
465465

466-
/** The documented sample (`content/docs/utilities/vscode-extension.mdx`), in declared types. */
466+
/**
467+
* The documented sample (`content/docs/utilities/vscode-extension.mdx`). Both
468+
* of its types are declared: `div`, and `h1`, one of the HTML passthrough tags
469+
* `HtmlElementSchema` declares (objectui#8499).
470+
*/
467471
const DOC_SAMPLE_SCHEMA = JSON.stringify(
468472
{
469473
type: 'div',
470474
className: 'p-4',
471-
children: [{ type: 'text', variant: 'h1', content: 'Hello World' }],
475+
children: [{ type: 'h1', children: 'Hello World' }],
472476
},
473477
null,
474478
2

0 commit comments

Comments
 (0)