📄 specifierNameMatches¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 1 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/type-utils/src/typeOrValueSpecifiers/specifierNameMatches.ts
Functions¶
specifierNameMatches(type: ts.Type, names: string | string[]): boolean¶
Parameters:
typets.Typenamesstring | string[]
Returns: boolean
Calls:
type.getSymbolnames.somecandidateNames.includes
Code
export function specifierNameMatches(
type: ts.Type,
names: string | string[],
): boolean {
if (typeof names === 'string') {
names = [names];
}
const symbol = type.aliasSymbol ?? type.getSymbol();
const candidateNames = symbol
? [symbol.escapedName as string, type.intrinsicName]
: [type.intrinsicName];
if (names.some(item => candidateNames.includes(item))) {
return true;
}
return false;
}
Generated by Syntax Scribe