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)
| 1093 | |
| 1094 | /** The class a member's value has: a field's or variable's declared type, a property's, a function's result. */ |
| 1095 | function typeOfMember(member: Node, context: ResolutionContext): Node | null { |
| 1096 | const memo = memos(context).memberTypes; |
| 1097 | if (memo.has(member.id)) return memo.get(member.id)!; |
| 1098 | let typeName: string | undefined; |
| 1099 | if (member.kind === 'method' || member.kind === 'function') { |
| 1100 | typeName = member.returnType ?? /:\s*([A-Za-z_][\w.]*)\s*;?\s*$/.exec(member.signature ?? '')?.[1]; |
| 1101 | } else { |
| 1102 | typeName = /^([A-Za-z_][\w.]*)/.exec(declaredTypeText(member, context))?.[1]; |
| 1103 | } |
| 1104 | const type = typeName ? classNamed(typeName, member.filePath, context) : null; |
| 1105 | memo.set(member.id, type); |
| 1106 | return type; |
| 1107 | } |
| 1108 | |
| 1109 | /** |
| 1110 | * The text of the type a field, variable, constant or property declares, |
no test coverage detected