(namedBlock: string)
| 91 | } |
| 92 | |
| 93 | function parseNames(namedBlock: string): Set<string> { |
| 94 | const withoutComments = stripComments(namedBlock) |
| 95 | const names = withoutComments |
| 96 | .split(',') |
| 97 | .map((part) => part.trim()) |
| 98 | .filter(Boolean) |
| 99 | .map((part) => |
| 100 | part |
| 101 | .replace(/^type\s+/, '') |
| 102 | .split(/\s+as\s+/)[0] |
| 103 | ?.trim(), |
| 104 | ) |
| 105 | .filter((name): name is string => Boolean(name)) |
| 106 | |
| 107 | return new Set(names) |
| 108 | } |
| 109 | |
| 110 | function stripComments(source: string) { |
| 111 | return source.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '') |
no test coverage detected