Closed Dagur closed 4 days ago
Hi @Dagur and @etrepum
My partner @RommyT1 and I are students from the University of Michigan working on a Software Engineering course project, where we contribute to open-source software. My partner and I would like to take on this issue as it aligns well with our coursework requirements, and we’re interested in helping improve lexical!
Could you please assign this issue to us? We were able to reproduce this issue locally, and we’d be happy to work on developing and testing a solution. We will make sure to maintain high code quality and follow lexical and facebook's standards.
Thank you for considering our request!
Hi @Dagur and @etrepum
@RommyT1 and I have implemented a potential fix for this issue. We added the missing calculateZoomLevel
declaration in LexicalUtils.js.flow
to resolve the Flow error. Additionally, while working on this, we noticed a few other functions that were missing Flow type declarations, so we added the following declarations as well:
declare export function $getNextRightPreorderNode(
startingNode: LexicalNode,
): LexicalNode | null;
declare export function calculateZoomLevel(element: Element | null): number;
declare export function $isEditorIsNestedEditor(editor: LexicalEditor): boolean;
declare export function objectKlassEquals<T>(
object: mixed,
objectClass: Class<T>,
): boolean;
declare export function $filter<T>(
nodes: Array<LexicalNode>,
filterFn: (node: LexicalNode) => null | T,
): Array<T>;
declare export function $insertFirst(parent: ElementNode, node: LexicalNode): void;
When testing these changes we observed that Flow now correctly recognizes these functions and can be used without $FlowFixMe
comments.
Please let us know if there are any questions or further adjustments you’d like us to make. Thank you!
If you submit this as a PR we can review it
Thanks!
Thanks!
No problem, this was our first time contributing to an open source, I'm glad we could help!
Thank you for your contribution!
Lexical version: 0.20.0
Steps To Reproduce
Link to code example:
Just enable flow and try this import
The current behavior
The function works like it should but a $FlowFixMe is needed to suppress the flow error
The expected behavior
No Flow error
Impact of fix
Low severity