* The class a member's value is of: a field's, a variable's or a property's * declared type, a function's result; indexed, the element of an array or a * generic list, or what an array property gives.
(member: Node, indexed: boolean, context: ResolutionContext)
| 1620 | * generic list, or what an array property gives. |
| 1621 | */ |
| 1622 | function valueTypeOf(member: Node, indexed: boolean, context: ResolutionContext): Node | null { |
| 1623 | if (isRoutine(member)) { |
| 1624 | const result = member.returnType ?? /(?:^|\))\s*:\s*([^;]+?)\s*;?\s*$/.exec(member.signature ?? '')?.[1]; |
| 1625 | return result ? typeOfText(result, member.filePath, indexed, context) : null; |
| 1626 | } |
| 1627 | // An array property's declared type is its element's: `property Items[I: Integer]: TItem`. |
| 1628 | const arrayProperty = indexed && member.kind === 'property' && |
| 1629 | new RegExp(`\\bproperty\\s+${escapeRegExp(member.name)}\\s*\\[`, 'i').test(fileLines(member.filePath, context)[member.startLine - 1] ?? ''); |
| 1630 | return typeOfText(declaredTypeText(member, context), member.filePath, indexed && !arrayProperty, context); |
| 1631 | } |
| 1632 | |
| 1633 | /** |
| 1634 | * The class a written type names (through its aliases, see classNamed); for |
no test coverage detected