The class a member's value has: a field's or variable's declared type, a property's, a function's result.
(member: Node, context: ResolutionContext)
| 2629 | |
| 2630 | /** The class a member's value has: a field's or variable's declared type, a property's, a function's result. */ |
| 2631 | function typeOfMember(member: Node, context: ResolutionContext): Node | null { |
| 2632 | const memo = memos(context).memberTypes; |
| 2633 | if (memo.has(member.id)) return memo.get(member.id)!; |
| 2634 | let typeName: string | undefined; |
| 2635 | if (member.kind === 'method' || member.kind === 'function') { |
| 2636 | typeName = member.returnType ?? /:\s*([A-Za-z_][\w.]*)\s*;?\s*$/.exec(member.signature ?? '')?.[1]; |
| 2637 | } else { |
| 2638 | typeName = /^([A-Za-z_][\w.]*)/.exec(declaredTypeText(member, context))?.[1]; |
| 2639 | } |
| 2640 | const type = typeName ? classNamed(typeName, member.filePath, context) : null; |
| 2641 | memo.set(member.id, type); |
| 2642 | return type; |
| 2643 | } |
| 2644 | |
| 2645 | /** |
| 2646 | * The text of the type a field, variable, constant or property declares, |
no test coverage detected