Skip to content

[lexical] Modernize Flow type-stub syntax rejected by fb-www flow strict - #8742

Merged
potatowagon merged 1 commit into
mainfrom
fix-flow-stub-syntax-fbwww-strict
Jun 24, 2026
Merged

potatowagon merged 1 commit into
mainfrom
fix-flow-stub-syntax-fbwww-strict

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

Three OSS Flow type-stub (.js.flow) files contain a few stragglers using older Flow syntax (and one lib-dependent type) that fb-www @flow strict rejects — this is what breaks flow-check on the www Lexical sync. The rest of these same files already use the modern equivalents (readonly / unknown / extends), so this just makes the recent additions (mostly from #8694 shadow-root work) consistent with the prevailing style. Mirrors internal www fix D109526234.

Changes

1) packages/lexical/flow/Lexical.js.flow

  • StaticRange declared shape: property variance sigils (+) → readonly
  • isDOMShadowRoot(node: mixed) → node: unknown
  • $insertNodeToNearestRootAtCaret<T: LexicalNode> → <T extends LexicalNode>

2) packages/lexical-link/flow/LexicalLink.js.flow (affects both registerClickableLink overloads)

  • Delete type AddEventListenerOptions = Exclude<EventListenerOptionsOrUseCapture, boolean>;
  • eventOptions?: Pick<AddEventListenerOptions, 'signal'> → eventOptions?: {signal?: AbortSignal, ...}
  • The Pick chain resolves through a DOM lib union that includes the primitive boolean, which fb-www flow can't Pick; the inline object is portable and equivalent.

3) packages/lexical-react/flow/useLexicalSlotRef.js.flow

  • useLexicalSlotRef<T: HTMLElement = HTMLElement> → <T extends HTMLElement = HTMLElement>

Notes

  • These are .js.flow type stubs only — no runtime/source code changes.
  • The actual file paths are under the flow/ subdirectory of each package (the request listed them without the flow/ segment; corrected here).

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 24, 2026
@vercel

vercel Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview Jun 24, 2026 6:33am
lexical-playground Ready Ready Preview Jun 24, 2026 6:33am

Request Review

@potatowagon
potatowagon added this pull request to the merge queue Jun 24, 2026
Merged via the queue into main with commit 9acca46 Jun 24, 2026
47 checks passed
@etrepum etrepum mentioned this pull request Jun 25, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — 6df3bbca Deployed Jun 24, 2026 by vercel[bot]
Preview – lexical-playground — 6df3bbca Deployed Jun 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants