(node, checker, contextualType, unionSymbolOk)
| 166265 | /** Gets all symbols for one property. Does not get symbols for every property. */ |
| 166266 | /* @internal */ |
| 166267 | function getPropertySymbolsFromContextualType(node, checker, contextualType, unionSymbolOk) { |
| 166268 | var name = ts.getNameFromPropertyName(node.name); |
| 166269 | if (!name) |
| 166270 | return ts.emptyArray; |
| 166271 | if (!contextualType.isUnion()) { |
| 166272 | var symbol = contextualType.getProperty(name); |
| 166273 | return symbol ? [symbol] : ts.emptyArray; |
| 166274 | } |
| 166275 | var discriminatedPropertySymbols = ts.mapDefined(contextualType.types, function (t) { return (ts.isObjectLiteralExpression(node.parent) || ts.isJsxAttributes(node.parent)) && checker.isTypeInvalidDueToUnionDiscriminant(t, node.parent) ? undefined : t.getProperty(name); }); |
| 166276 | if (unionSymbolOk && (discriminatedPropertySymbols.length === 0 || discriminatedPropertySymbols.length === contextualType.types.length)) { |
| 166277 | var symbol = contextualType.getProperty(name); |
| 166278 | if (symbol) |
| 166279 | return [symbol]; |
| 166280 | } |
| 166281 | if (discriminatedPropertySymbols.length === 0) { |
| 166282 | // Bad discriminant -- do again without discriminating |
| 166283 | return ts.mapDefined(contextualType.types, function (t) { return t.getProperty(name); }); |
| 166284 | } |
| 166285 | return discriminatedPropertySymbols; |
| 166286 | } |
| 166287 | ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; |
| 166288 | function isArgumentOfElementAccessExpression(node) { |
| 166289 | return node && |
no outgoing calls
no test coverage detected