-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lexical] Bug Fix: Missing variables and functions in Flow file #6866
Conversation
Missing variables and functions in Flow file.
Hi @lytion! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
@@ -256,6 +256,7 @@ export type EditorThemeClasses = { | |||
ulDepth?: Array<EditorThemeClassName>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when i run flow on these changes i get this error, other files may need updating
[[email protected] /data/sandcastle/boxes/www (c0d10ff15)]$ flow
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ html/shared/lexical/Lexical.js.flow:469:22
Cannot implement BaseSelection [1] with NodeSelection because property _cachedNodes is missing in NodeSelection [2]
but exists in BaseSelection [1]. [prop-missing]
466│ setCachedNodes(nodes: null | Array<LexicalNode>): void;
467│ }
468│
[2][1] 469│ declare export class NodeSelection implements BaseSelection {
470│ _nodes: Set<NodeKey>;
471│ dirty: boolean;
472│ constructor(objects: Set<NodeKey>): void;
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ html/shared/lexical/Lexical.js.flow:469:22
Cannot implement BaseSelection [1] with NodeSelection because property getStartEndPoints is missing in
NodeSelection [2] but exists in BaseSelection [1]. [prop-missing]
466│ setCachedNodes(nodes: null | Array<LexicalNode>): void;
467│ }
468│
[2][1] 469│ declare export class NodeSelection implements BaseSelection {
470│ _nodes: Set<NodeKey>;
471│ dirty: boolean;
472│ constructor(objects: Set<NodeKey>): void;
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ html/shared/lexical/Lexical.js.flow:469:22
Cannot implement BaseSelection [1] with NodeSelection because property isBackward is missing in NodeSelection [2]
but exists in BaseSelection [1]. [prop-missing]
466│ setCachedNodes(nodes: null | Array<LexicalNode>): void;
467│ }
468│
[2][1] 469│ declare export class NodeSelection implements BaseSelection {
470│ _nodes: Set<NodeKey>;
471│ dirty: boolean;
472│ constructor(objects: Set<NodeKey>): void;
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ html/shared/lexical/Lexical.js.flow:469:22
Cannot implement BaseSelection [1] with NodeSelection because property isCollapsed is missing in NodeSelection [2]
but exists in BaseSelection [1]. [prop-missing]
466│ setCachedNodes(nodes: null | Array<LexicalNode>): void;
467│ }
468│
[2][1] 469│ declare export class NodeSelection implements BaseSelection {
470│ _nodes: Set<NodeKey>;
471│ dirty: boolean;
472│ constructor(objects: Set<NodeKey>): void;
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ html/shared/lexical/Lexical.js.flow:493:22
Cannot implement BaseSelection [1] with RangeSelection because property _cachedNodes is missing in
RangeSelection [2] but exists in BaseSelection [1]. [prop-missing]
490│ x: ?mixed,
491│ ): x is NodeSelection;
492│
[2][1] 493│ declare export class RangeSelection implements BaseSelection {
494│ anchor: PointType;
495│ focus: PointType;
496│ dirty: boolean;
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ html/shared/lexical/Lexical.js.flow:493:22
Cannot implement BaseSelection [1] with RangeSelection because property getStartEndPoints is missing in
RangeSelection [2] but exists in BaseSelection [1]. [prop-missing]
490│ x: ?mixed,
491│ ): x is NodeSelection;
492│
[2][1] 493│ declare export class RangeSelection implements BaseSelection {
494│ anchor: PointType;
495│ focus: PointType;
496│ dirty: boolean;
Error ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ html/shared/lexical/LexicalTable.js.flow:323:22
Cannot implement BaseSelection [1] with TableSelection because property _cachedNodes is missing in
TableSelection [2] but exists in BaseSelection [1]. [prop-missing]
320│ toX: number,
321│ toY: number,
322│ };
[2][1] 323│ declare export class TableSelection implements BaseSelection {
324│ tableKey: NodeKey;
325│ anchor: PointType;
326│ focus: PointType;
Found 7 errors
The Flow server is currently in lazy mode and is only checking 585463/1396902 files.
To learn more, visit flow.org/en/docs/lang/lazy-modes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is weird, I can see these functions in https://lexical.dev/docs/api/interfaces/lexical.BaseSelection
I directly added this on my project and everything was fine but maybe I'm missing out something. I will try on the repo when I have some time
@@ -446,13 +447,17 @@ declare export function $isBlockElementNode( | |||
): node is ElementNode; | |||
|
|||
export interface BaseSelection { | |||
clone(): BaseSelection; | |||
_cachedNodes: Array<LexicalNode> | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be here. It's not a public interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, and its breaking other apis too
@@ -528,6 +533,7 @@ declare export class RangeSelection implements BaseSelection { | |||
} | |||
export type TextPoint = TextPointType; | |||
type TextPointType = { | |||
_selection: BaseSelection, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_selection isn't part of the public interface for these point types either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I must have used it incorrectly. I was trying to access rangeSelection.anchor._selection.getStartEndPoints()
but I guess I should have used rangeSelection.getStartEndPoints()
.
I removed all private variables and added missing functions in |
https://github.com/facebook/lexical/actions/runs/12027063755/job/33527314547?pr=6866 npm run ci-check which runs flow has errors,
|
Will create a new PR without using the github editor system which I'm not used to of |
Missing variables and functions in Flow file.
Description
I found that some variables and function are missing in the lexical Flow file, here is a suggested fix.