Skip to content

Commit

Permalink
refactor implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed May 12, 2024
1 parent 65eb5bf commit 35eae1c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/lexical-list/src/LexicalListItemNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
*/

import type {ListNode} from './';
import type {ListNode, ListType} from './';
import type {
BaseSelection,
DOMConversionMap,
Expand Down Expand Up @@ -321,11 +321,12 @@ export class ListItemNode extends ElementNode {
getChecked(): boolean | undefined {
const self = this.getLatest();

let listType: ListType | undefined;

const parent = this.getParent();
if (!$isListNode(parent)) {
invariant(false, 'getChecked: list node is not parent of list item node');
if ($isListNode(parent)) {
listType = parent.getListType();
}
const listType = parent.getListType();

return listType === 'check' ? Boolean(self.__checked) : undefined;
}
Expand Down

0 comments on commit 35eae1c

Please sign in to comment.