Sha256: 85ad1585c00de04bec829011555cc9fa5d33d0a0ca1089676688460d50c94640
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = removeTypeDuplicates; var _generated = require("../../validators/generated"); function removeTypeDuplicates(nodes) { const generics = {}; const bases = {}; const typeGroups = new Set(); const types = []; for (let i = 0; i < nodes.length; i++) { const node = nodes[i]; if (!node) continue; if (types.indexOf(node) >= 0) { continue; } if ((0, _generated.isTSAnyKeyword)(node)) { return [node]; } if ((0, _generated.isTSBaseType)(node)) { bases[node.type] = node; continue; } if ((0, _generated.isTSUnionType)(node)) { if (!typeGroups.has(node.types)) { nodes.push(...node.types); typeGroups.add(node.types); } continue; } types.push(node); } for (const type of Object.keys(bases)) { types.push(bases[type]); } for (const name of Object.keys(generics)) { types.push(generics[name]); } return types; }
Version data entries
7 entries across 7 versions & 1 rubygems