Skip to content

Commit

Permalink
[lexical-react] replace abstract component (#6752)
Browse files Browse the repository at this point in the history
  • Loading branch information
potatowagon authored Oct 25, 2024
1 parent 409c65e commit e96ee55
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ untyped-type-import=error
[options]
server.max_workers=4
exact_by_default=true
component_syntax=true

;; [generated-start update-flowconfig]
module.name_mapper='^lexical$' -> '<PROJECT_ROOT>/packages/lexical/flow/Lexical.js.flow'
Expand Down Expand Up @@ -105,4 +106,4 @@ nonstrict-import
unclear-type

[version]
^0.226.0
^0.250.0
1 change: 1 addition & 0 deletions libdefs/yjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ declare module 'yjs' {
};

declare type StackItem = {
// $FlowFixMe: perhaps add generic typing instead of mixed
meta: Map<mixed, mixed>,
type: 'undo' | 'redo',
};
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"flow-bin": "^0.226.0",
"flow-bin": "^0.250.0",
"fs-extra": "^10.0.0",
"glob": "^10.4.1",
"google-closure-compiler": "^20220202.0.0",
Expand Down
20 changes: 9 additions & 11 deletions packages/lexical-react/flow/LexicalContentEditable.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import type { LexicalEditor } from 'lexical';
import type {TRefFor} from 'CoreTypes.flow';

import * as React from 'react';
import type { AbstractComponent } from "react";

type InlineStyle = {
[key: string]: mixed;
}
[key: string]: mixed,
};

// Due to Flow limitations, we prefer fixed types over the built-in inexact HTMLElement
type HTMLDivElementDOMProps = $ReadOnly<{
Expand All @@ -29,7 +28,7 @@ type HTMLDivElementDOMProps = $ReadOnly<{
'aria-invalid'?: void | boolean,
'aria-owns'?: void | string,
'title'?: void | string,
onClick?: void | (e: SyntheticEvent<HTMLDivElement>) => mixed,
onClick?: void | ((e: SyntheticEvent<HTMLDivElement>) => mixed),
autoCapitalize?: void | boolean,
autoComplete?: void | boolean,
autoCorrect?: void | boolean,
Expand Down Expand Up @@ -72,11 +71,10 @@ export type Props = $ReadOnly<{
ariaOwns?: string,
ariaRequired?: string,
autoCapitalize?: boolean,
ref?: TRefFor<HTMLDivElement>,
...PlaceholderProps
}>
...PlaceholderProps,
}>;

declare export var ContentEditable: AbstractComponent<
Props,
HTMLDivElement,
>;
declare export var ContentEditable: component(
ref: React.RefSetter<HTMLDivElement>,
...Props
);

0 comments on commit e96ee55

Please sign in to comment.