Repository navigation
[lexical] Bug Fix: Keep the deprecated unchecked node type arguments in the Flow declarations - #9529
Merged
Merged
Conversation
…in the Flow declarations ## Description v0.53.0 (#9479) removed the unchecked type-argument overloads of `getParent`, `getParentOrThrow`, `getParents`, `getPreviousSibling`, `getPreviousSiblings`, `getNextSibling`, `getNextSiblings`, `getChildren`, `getFirstChild`, `getFirstChildOrThrow`, `getLastChild`, `getLastChildOrThrow`, `getChildAtIndex`, `getFirstDescendant`, `getLastDescendant`, `getDescendantByIndex`, `$getNodeByKey` and `$getNodeByKeyOrThrow` from the TypeScript declarations and, in the same release, from the hand-maintained Flow declarations in `packages/lexical/flow/Lexical.js.flow`. TypeScript carried those overloads as `@deprecated` for several releases before removing them, so a TypeScript codebase was told in its editor long before the call sites stopped checking. Flow has no deprecation signal: the `@deprecated` tag on a `.js.flow` declaration is a comment and nothing reads it, so for Flow this was a removal with no notice at all. Every call site that passes a type argument fails at once with `nonpolymorphic-type-arg`, and the `prop-missing` and `incompatible-type` errors that follow where the cast was load-bearing. The upgrade has no codemod, by design — each site needs the guard that fits its context — so a large Flow codebase cannot cross this in one step. Restore the overloads in the Flow declarations only, still `@deprecated`, with the comment saying that the TypeScript overload is gone and that these stay until the remaining Flow call sites are migrated. TypeScript is unchanged, the guidance in `traversals.md` is unchanged, and new code in either language should call these methods without a type argument and narrow the result with a node guard. ## Test plan ### Before `flow check` over Meta's www Flow root with v0.53.0's declarations in place (paths redacted): ``` Error --------------------------------------------------------------------- <redacted>/SomeLayoutPlugin.js:129:26 Cannot call non-polymorphic `() => Array<LexicalNode>` [1] with type arguments. [nonpolymorphic-type-arg] 129| const children = node.getChildren<LexicalNode>(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ References: html/shared/lexical/Lexical.js.flow:974:3 974| getChildren(): LexicalNode[]; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1] Found 2174 errors ``` ### After The same root, same revision, with this change applied to `Lexical.js.flow`: ``` $ flow check . No errors! real 10m6.650s ``` The OSS checks were not run in this environment (its package manager is not available there); CI runs `pnpm run ci-check` on this PR.
potatowagon
requested review from
acywatson,
etrepum,
ivailop7 and
zurfyx
as code owners
October 29, 2026 15:30
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
lexical
@lexical/a11y
@lexical/clipboard
@lexical/code
@lexical/code-core
@lexical/code-prism
@lexical/code-shiki
@lexical/compiler
@lexical/devtools-core
@lexical/dragon
@lexical/eslint-plugin
@lexical/extension
@lexical/fast-check
@lexical/file
@lexical/hashtag
@lexical/headless
@lexical/history
@lexical/html
@lexical/internal
@lexical/link
@lexical/list
@lexical/mark
@lexical/markdown
@lexical/mdast
@lexical/offset
@lexical/overflow
@lexical/plain-text
@lexical/react
@lexical/rich-text
@lexical/selection
@lexical/table
@lexical/tailwind
@lexical/text
@lexical/utils
@lexical/y
@lexical/yjs
commit: |
etrepum
approved these changes
Oct 29, 2026
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
v0.53.0 (#9479) removed the unchecked type-argument overloads of
getParent,getParentOrThrow,getParents,getPreviousSibling,getPreviousSiblings,getNextSibling,getNextSiblings,getChildren,getFirstChild,getFirstChildOrThrow,getLastChild,getLastChildOrThrow,getChildAtIndex,getFirstDescendant,getLastDescendant,getDescendantByIndex,$getNodeByKeyand$getNodeByKeyOrThrowfrom theTypeScript declarations and, in the same release, from the hand-maintained
Flow declarations in
packages/lexical/flow/Lexical.js.flow.TypeScript carried those overloads as
@deprecatedfor several releasesbefore removing them, so a TypeScript codebase was told in its editor long
before the call sites stopped checking. Flow has no deprecation signal: the
@deprecatedtag on a.js.flowdeclaration is a comment and nothing readsit, so for Flow this was a removal with no notice at all. Every call site that
passes a type argument fails at once with
nonpolymorphic-type-arg, plus theprop-missingandincompatible-typeerrors that follow wherever the castwas load-bearing. The upgrade has no codemod, by design — each site needs the
guard that fits its context — so a large Flow codebase cannot cross this in
one step, and the Meta www sync that imports v0.53.0 is blocked on 2,174 such
errors.
This restores the overloads in the Flow declarations only, still
@deprecated, with the comment now saying that the TypeScript overload isgone and that these stay until the remaining Flow call sites are migrated.
TypeScript is unchanged,
traversals.mdis unchanged, and new code in eitherlanguage should call these methods without a type argument and narrow the
result with a node guard.
Changeset
.changeset/restore-flow-unchecked-node-type-arguments.md—[fix]onlexical, since the shipped Flow types change for consumers.Test plan
Before
flow checkover Meta's www Flow root with v0.53.0's declarations in place(paths redacted):
After
The same root at the same revision, with this change applied to its copy of
Lexical.js.flow:The repository's own checks were not run in this environment (its package
manager is unavailable there); CI runs
pnpm run ci-checkon this PR.