docs/api.md documents props as `PropTypes`, and several entries are wrong
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- react, typescript
- Domain
- documentation, frontend
Research direction
Start with docs/api.md and audit its four prop tables against the TypeScript declarations and the LiveProvider transformCode call site. Update the documented types and defaults, correct the transformCode return type, and account for LiveEditor’s Partial surface. A changeset is needed for the published declaration change.
Written by the indexing model from the issue text.
Description
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:
language = "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
elementalong the way. - While in there,
LiveEditortakesPartial<EditorProps>, so the three documented props
are not its whole surface.
- Dominant language
- TypeScript
- Stars
- 4.6k
- Forks
- 260
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 1
Contributor guide
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.
More from FormidableLabs/react-live
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
FormidableLabs/react-live#417 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
FormidableLabs/react-live#415 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
FormidableLabs/react-live#413 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
FormidableLabs/react-live#411 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
FormidableLabs/react-live#410 · 1 comment ·
All issues in FormidableLabs/react-live
Similar issues
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Crush Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ElementsProject/cln-application#167 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Quantco/pnpm-licenses#17 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100