Repository navigation
[lexical-website] Documentation Update: fix two nodes.mdx snippets that do not compile - #9200
Merged
Merged
Conversation
…at do not compile
## Description
Two TypeScript snippets in `concepts/nodes.mdx` cannot be compiled as written:
1. The custom-node serialization example declares
`interface SerializedCustomNode`, but every use of it in the same snippet —
the `importJSON` and `updateFromJSON` parameter types and the `exportJSON`
return type — says `SerializedMyCustomNode`. The declared name is never
referenced and the referenced name is never declared.
2. Both `ColoredNode` examples annotate their constructor with a return type:
`constructor(..., key?: NodeKey): void {`. A TypeScript constructor cannot
carry a return-type annotation (`TS1093`); this is a leftover from the Flow
era. No constructor in the repo's own node classes has one.
This renames the interface to match its uses and drops the two `: void`
annotations. No prose changes.
## Test plan
Documentation-only change (markdown is excluded from prettier via
`.prettierignore`), so the check is that the snippets are now valid TypeScript.
### Before
```
$ grep -n "SerializedCustomNode\|SerializedMyCustomNode" packages/lexical-website/docs/concepts/nodes.mdx
145:interface SerializedCustomNode extends SerializedLexicalNode {
163: serializedNode: LexicalUpdateJSON<SerializedMyCustomNode>,
174: serializedNode: LexicalUpdateJSON<SerializedMyCustomNode>,
182: exportJSON(): SerializedMyCustomNode {
183: const serializedNode: SerializedMyCustomNode = super.exportJSON();
$ grep -n "): void {" packages/lexical-website/docs/concepts/nodes.mdx
572: ): void {
934: constructor(text: string, color: string, key?: NodeKey): void {
```
`SerializedMyCustomNode` is undeclared, and both constructors are `TS1093`
("Type annotation cannot appear on a constructor declaration").
### After
```
$ grep -n "SerializedCustomNode\|SerializedMyCustomNode" packages/lexical-website/docs/concepts/nodes.mdx
145:interface SerializedMyCustomNode extends SerializedLexicalNode {
163: serializedNode: LexicalUpdateJSON<SerializedMyCustomNode>,
174: serializedNode: LexicalUpdateJSON<SerializedMyCustomNode>,
182: exportJSON(): SerializedMyCustomNode {
183: const serializedNode: SerializedMyCustomNode = super.exportJSON();
$ grep -n "): void {" packages/lexical-website/docs/concepts/nodes.mdx
$ grep -n "constructor(text: string, color" packages/lexical-website/docs/concepts/nodes.mdx
934: constructor(text: string, color: string, key?: NodeKey) {
```
The interface name now matches its five uses, and neither constructor carries a
return type — matching the node classes in `packages/lexical/src/nodes/`.
potatowagon
requested review from
acywatson,
etrepum,
fantactuka,
ivailop7 and
zurfyx
as code owners
September 23, 2026 06:31
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
etrepum
reviewed
Sep 23, 2026
etrepum
left a comment
Collaborator
There was a problem hiding this comment.
there's a prettier ci-check failure here, and maybe opening separate PRs for the same file is not ideal since they may conflict
…uctor for prettier
## Description
Follow-up to the parent commit, which dropped the invalid `: void` return
annotations from the two `ColoredNode` constructors. Removing ` : void` made
the first constructor's parameter list fit on one 80-column line, so prettier
now wants it collapsed rather than split across four lines. `.mdx` is not in
`.prettierignore` (only `**/*.md` is), so `pnpm run ci-check` fails on it.
No content change — purely the formatter's line break.
## Test plan
### Before
```
$ npx prettier --check packages/lexical-website/docs/concepts/nodes.mdx
Checking formatting...
[warn] packages/lexical-website/docs/concepts/nodes.mdx
[warn] Code style issues found in the above file. Run Prettier with --write to fix.
```
### After
```
$ npx prettier --check packages/lexical-website/docs/concepts/nodes.mdx
Checking formatting...
All matched files use Prettier code style!
$ sed -n '568p' packages/lexical-website/docs/concepts/nodes.mdx | awk '{print length($0)}'
80
```
etrepum
approved these changes
Sep 23, 2026
Merged
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two TypeScript snippets in
concepts/nodes.mdxcannot be compiled as written:interface SerializedCustomNode, but every use of it in the same snippet —the
importJSONandupdateFromJSONparameter types and theexportJSONreturn type — says
SerializedMyCustomNode. The declared name is neverreferenced and the referenced name is never declared.
ColoredNodeexamples annotate their constructor with a return type:constructor(..., key?: NodeKey): void {. A TypeScript constructor cannotcarry a return-type annotation (
TS1093); this is a leftover from the Flowera. No constructor in the repo's own node classes has one.
This renames the interface to match its uses and drops the two
: voidannotations. No prose changes.
Test plan
Documentation-only change (markdown is excluded from prettier via
.prettierignore), so the check is that the snippets are now valid TypeScript.Before
SerializedMyCustomNodeis undeclared, and both constructors areTS1093("Type annotation cannot appear on a constructor declaration").
After
The interface name now matches its five uses, and neither constructor carries a
return type — matching the node classes in
packages/lexical/src/nodes/.