Skip to content

[lexical] Modernize InlineFormattableNode Flow stub syntax rejected by fb-www flow strict - #8763

Merged
etrepum merged 1 commit into
meta:mainfrom
potatowagon:navi/fix/inline-formattable-flow-strict
Jun 30, 2026
Merged

etrepum merged 1 commit into
meta:mainfrom
potatowagon:navi/fix/inline-formattable-flow-strict

Conversation

@potatowagon

Copy link
Copy Markdown
Contributor

Description

The hand-maintained InlineFormattableNode Flow stub in packages/lexical/flow/Lexical.js.flow uses legacy Flow syntax that Meta's internal fb-www flow strict mode rejects, breaking the www Lexical sync:

  • +__isInlineFormattable: true; — covariant-property shorthand → readonly __isInlineFormattable: true;
  • setFormat(format: number): mixed; → setFormat(format: number): unknown;
  • toggleFormat(type: TextFormatType): mixed; → toggleFormat(type: TextFormatType): unknown;

This is the same class of fix as #8742 ("Modernize Flow type-stub syntax rejected by fb-www flow strict"). The InlineFormattableNode interface was added in #8737 after #8742 landed, so it reintroduced the old syntax.

The TypeScript source already uses the modern forms — packages/lexical/src/nodes/LexicalTextNode.ts:

export interface InlineFormattableNode {
  /** @internal */
  readonly __isInlineFormattable: true;
  getFormatFlags(type: TextFormatType, alignWithFormat: null | number): number;
  hasFormat(type: TextFormatType): boolean;
  setFormat(format: number): unknown;
  toggleFormat(type: TextFormatType): unknown;
}

So this change only aligns the Flow stub with the existing .d.ts/TS definition — no semantic change to exports or signatures.

Test plan

  • readonly and unknown are the same types the TS source declares, so flow/d.ts export consistency is preserved.
  • Verified there are no other +-covariant or mixed usages remaining in any packages/**/*.js.flow stub.
  • Validated against fb-www flow strict via the internal Lexical sync.

…-www flow strict

The InlineFormattableNode interface in the hand-maintained Lexical.js.flow
stub used legacy Flow syntax that fb-www's flow strict mode rejects:

- `+__isInlineFormattable` covariant shorthand -> `readonly`
- `mixed` return types -> `unknown`

This is the same class of fix as meta#8742, which the InlineFormattableNode
declaration (added in meta#8737) regressed. The TS source in LexicalTextNode.ts
already uses `readonly` and `unknown`, so this only aligns the Flow stub
with the existing TS definition.
@vercel

vercel Bot commented Jun 30, 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 30, 2026 8:21am
lexical-playground Ready Ready Preview Jun 30, 2026 8:21am

Request Review

@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 30, 2026
@potatowagon

Copy link
Copy Markdown
Contributor Author

Verified against fb-www flow strict on a www OnDemand (Flow 0.321.0).

Before (flow check-contents on the synced stub):

Error -- html/shared/lexical/Lexical.js.flow:817:3
The `+` variance sigil is deprecated. Use `readonly` instead. [unsupported-syntax]
   817|   +__isInlineFormattable: true;
Error -- html/shared/lexical/Lexical.js.flow:820:30
The utility type `mixed` is deprecated, use `unknown` instead. [deprecated-utility]  (unsuppressable)
   820|   setFormat(format: number): mixed;
Error -- html/shared/lexical/Lexical.js.flow:821:39
The utility type `mixed` is deprecated, use `unknown` instead. [deprecated-utility]  (unsuppressable)
   821|   toggleFormat(type: TextFormatType): mixed;
Found 3 errors

After this change:

No errors!

Note the mixed -> unknown errors are [deprecated-utility] and unsuppressable in the fb-www config, so the Lexical sync diff cannot land without this fix. The TS source (LexicalTextNode.ts) already uses readonly/unknown, so this only realigns the Flow stub.

@etrepum
etrepum added this pull request to the merge queue Jun 30, 2026
Merged via the queue into meta:main with commit fdc51c9 Jun 30, 2026
44 checks passed
@etrepum etrepum mentioned this pull request Jul 9, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — b6cccd62 Deployed Jun 30, 2026 by vercel[bot]
Preview – lexical-playground — b6cccd62 Deployed Jun 30, 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