UNPKG

@yandex/ui

Version:

Yandex UI components

15 lines (12 loc) 506 B
import { filterTypes } from './filterTypes'; import { isNotEmptyUnion } from './isNotEmptyUnion'; module.exports.removeTypeReference = (root, j, typeValue) => { root.find(j.TSUnionType) .forEach((nodePath) => { nodePath.value.types = nodePath.value.types.filter((node) => filterTypes(node, typeValue)); }); root.find(j.TSIntersectionType) .forEach((nodePath) => { nodePath.value.types = nodePath.value.types.filter(isNotEmptyUnion); }); };