(type: string)
| 532 | const classByName = new Map<string, Node | null>(); |
| 533 | /** The class / interface / struct a declared type names in the index, or null for a library's. */ |
| 534 | const classOfType = async (type: string): Promise<Node | null> => { |
| 535 | const typeName = type.replace(/<.*$/, '').replace(/^[*&]+/, '').replace(/[?!]$/, '').split(/[.:]/).pop()?.trim() ?? ''; |
| 536 | if (!typeName || /^(?:string|number|boolean|any|unknown|object|void|String|Integer|Long|Boolean|int|long|bool|var|dynamic|Object|List|Map|Set|Array|Promise|Optional|Task|IEnumerable|Iterable)$/.test(typeName)) return null; |
| 537 | let cls = classByName.get(typeName); |
| 538 | if (cls === undefined) { |
| 539 | const found = cg.getNodesByName(typeName).filter((n) => n.kind === 'class' || n.kind === 'interface' || n.kind === 'struct'); |
| 540 | cls = found.find((n) => !isTestPath(n.filePath)) ?? found[0] ?? null; |
| 541 | classByName.set(typeName, cls); |
| 542 | } |
| 543 | return cls; |
| 544 | }; |
| 545 | // Swift has no per-symbol imports: a type the project declares shadows the |
| 546 | // SDK name the effect table keys on — IceCubesApp's `Notifications` |
| 547 | // endpoint enum is not expo-notifications. An `extension Timer {}` declares |
no test coverage detected