(parameter, type)
| 77737 | } |
| 77738 | } |
| 77739 | function assignParameterType(parameter, type) { |
| 77740 | var links = getSymbolLinks(parameter); |
| 77741 | if (!links.type) { |
| 77742 | var declaration = parameter.valueDeclaration; |
| 77743 | links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter)); |
| 77744 | if (declaration && declaration.name.kind !== 79 /* SyntaxKind.Identifier */) { |
| 77745 | // if inference didn't come up with anything but unknown, fall back to the binding pattern if present. |
| 77746 | if (links.type === unknownType) { |
| 77747 | links.type = getTypeFromBindingPattern(declaration.name); |
| 77748 | } |
| 77749 | assignBindingElementTypes(declaration.name, links.type); |
| 77750 | } |
| 77751 | } |
| 77752 | else if (type) { |
| 77753 | ts.Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type"); |
| 77754 | } |
| 77755 | } |
| 77756 | // When contextual typing assigns a type to a parameter that contains a binding pattern, we also need to push |
| 77757 | // the destructured type into the contained binding elements. |
| 77758 | function assignBindingElementTypes(pattern, parentType) { |
no test coverage detected
searching dependent graphs…