docs/api.md types every prop as PropTypes.string, PropTypes.bool, and so on — 16 rows
across four tables. There is no prop-types dependency in the repo. The props are
TypeScript, so the notation describes runtime validation that does not happen.
The file is already inconsistent with itself: the withLive() table types element as
React.Element, which is not a real type either (React.ReactElement).
Auditing the tables to convert them turned up three entries that are wrong on the facts, not
just the notation.
language default is documented as jsx
| language | `PropTypes.string` | ... (Default: `jsx`) |
LiveProvider defaults it to tsx:
LivePreview's Component is not a node
Documented as PropTypes.node. It is React.ElementType — a tag name or component, not
rendered output. node would be the wrong choice even in PropTypes terms (elementType).
transformCode's declared type contradicts its own call site
The docs say "accepts and returns the code to be transpiled", which matches what
LiveProvider actually does:
const transformResult = transformCode ? transformCode(newCode) : newCode;
const transformedCode = await Promise.resolve(transformResult);
if (typeof transformedCode !== "string") {
throw new Error("Code failed to transform");
}
The type says the return value is discarded:
transformCode?(code: string): void;
Here the docs are right and the source is wrong. TypeScript permits returning a value where
void is expected, so callers are not broken — but anyone reading the declarations sees a
mutator. Should be string | Promise<string>.
Order
- Fix
transformCode's return type. Separate from the docs work: it ships in the published
declarations and needs a changeset.
- Convert the four tables to TypeScript types, correcting
language, Component, and
element along the way.
- While in there,
LiveEditor takes Partial<EditorProps>, so the three documented props
are not its whole surface.
docs/api.mdtypes every prop asPropTypes.string,PropTypes.bool, and so on — 16 rowsacross four tables. There is no
prop-typesdependency in the repo. The props areTypeScript, so the notation describes runtime validation that does not happen.
The file is already inconsistent with itself: the
withLive()table typeselementasReact.Element, which is not a real type either (React.ReactElement).Auditing the tables to convert them turned up three entries that are wrong on the facts, not
just the notation.
languagedefault is documented asjsxLiveProviderdefaults it totsx:LivePreview'sComponentis not a nodeDocumented as
PropTypes.node. It isReact.ElementType— a tag name or component, notrendered output.
nodewould be the wrong choice even in PropTypes terms (elementType).transformCode's declared type contradicts its own call siteThe docs say "accepts and returns the code to be transpiled", which matches what
LiveProvideractually does:The type says the return value is discarded:
Here the docs are right and the source is wrong. TypeScript permits returning a value where
voidis expected, so callers are not broken — but anyone reading the declarations sees amutator. Should be
string | Promise<string>.Order
transformCode's return type. Separate from the docs work: it ships in the publisheddeclarations and needs a changeset.
language,Component, andelementalong the way.LiveEditortakesPartial<EditorProps>, so the three documented propsare not its whole surface.