This commit is contained in:
Nathan Bierema 2024-08-04 19:51:49 -04:00
parent 9bf0779f7b
commit 020cdff7d5

View File

@ -45,9 +45,9 @@ export function map2tree(
root: unknown, root: unknown,
options: { key?: string; pushMethod?: 'push' | 'unshift' } = {}, options: { key?: string; pushMethod?: 'push' | 'unshift' } = {},
tree: Node = { name: options.key || 'state', children: [] }, tree: Node = { name: options.key || 'state', children: [] },
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-empty-object-type
): Node | {} { ): Node | {} {
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-empty-object-type
if (!isPlainObject(root) && root && !(root as { toJS: () => {} }).toJS) { if (!isPlainObject(root) && root && !(root as { toJS: () => {} }).toJS) {
return {}; return {};
} }
@ -60,13 +60,13 @@ export function map2tree(
} }
mapValues( mapValues(
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-empty-object-type
root && (root as { toJS: () => {} }).toJS root && (root as { toJS: () => {} }).toJS
? // eslint-disable-next-line @typescript-eslint/ban-types ? // eslint-disable-next-line @typescript-eslint/no-empty-object-type
(root as { toJS: () => {} }).toJS() (root as { toJS: () => {} }).toJS()
: // eslint-disable-next-line @typescript-eslint/ban-types : // eslint-disable-next-line @typescript-eslint/no-empty-object-type
(root as {}), (root as {}),
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-empty-object-type
(maybeImmutable: { toJS?: () => {} }, key) => { (maybeImmutable: { toJS?: () => {} }, key) => {
const value = const value =
maybeImmutable && maybeImmutable.toJS maybeImmutable && maybeImmutable.toJS