( definition: Located, name: unknown )
| 4623 | |
| 4624 | // null where the definition has no alias by the name, undefined if unknown |
| 4625 | private aliasIn( |
| 4626 | definition: Located, |
| 4627 | name: unknown |
| 4628 | ): { value: Located; isGeneric: boolean } | null | undefined { |
| 4629 | if (typeof name !== "string") return |
| 4630 | const properties = membersOf(definition.node) |
| 4631 | for (let i = properties.length - 1; i >= 0; i--) { |
| 4632 | const property = properties[i] |
| 4633 | if (property.type === "SpreadElement") { |
| 4634 | const { module, kindOfKey } = definition |
| 4635 | const spread = |
| 4636 | this.literalOf(property.argument, module, kindOfKey) ?? |
| 4637 | this.moduleDefinitionOf(property.argument, module, kindOfKey) |
| 4638 | const alias = |
| 4639 | spread?.node.type === "ObjectExpression" ? |
| 4640 | this.aliasIn(spread, name) |
| 4641 | : undefined |
| 4642 | if (alias !== null) return alias |
| 4643 | continue |
| 4644 | } |
| 4645 | const key = "key" in property ? keyNameOf(property) : undefined |
| 4646 | if ( |
| 4647 | key === undefined || |
| 4648 | accessorKindOf(property) || |
| 4649 | property.type !== "Property" |
| 4650 | ) |
| 4651 | return |
| 4652 | const alias = String(key) |
| 4653 | const paramsStart = alias.indexOf("<") |
| 4654 | if ( |
| 4655 | alias[0] === "#" || |
| 4656 | (paramsStart === -1 ? alias : alias.slice(0, paramsStart)) !== name |
| 4657 | ) |
| 4658 | continue |
| 4659 | if (property.method) return |
| 4660 | return { |
| 4661 | value: { ...definition, node: property.value }, |
| 4662 | isGeneric: paramsStart !== -1 |
| 4663 | } |
| 4664 | } |
| 4665 | return null |
| 4666 | } |
| 4667 | |
| 4668 | private bindingLiteralOf( |
| 4669 | binding: Binding, |
no test coverage detected