@@ -67,6 +67,7 @@ namespace ts {
6767 // The language service will always care about the narrowed type of a symbol, because that is
6868 // the type the language says the symbol should have.
6969 getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol,
70+ getSymbolsOfParameterPropertyDeclaration,
7071 getDeclaredTypeOfSymbol,
7172 getPropertiesOfType,
7273 getPropertyOfType,
@@ -430,6 +431,26 @@ namespace ts {
430431 // return undefined if we can't find a symbol.
431432 }
432433
434+ /**
435+ * Get symbols that represent parameter-property-declaration as parameter and as property declaration
436+ * @param parameter a parameterDeclaration node
437+ * @param parameterName a name of the parameter to get the symbols for.
438+ * @return a tuple of two symbols
439+ */
440+ function getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): [Symbol, Symbol] {
441+ const constructoDeclaration = parameter.parent;
442+ const classDeclaration = parameter.parent.parent;
443+
444+ const parameterSymbol = getSymbol(constructoDeclaration.locals, parameterName, SymbolFlags.Value);
445+ const propertySymbol = getSymbol(classDeclaration.symbol.members, parameterName, SymbolFlags.Value);
446+
447+ if (parameterSymbol && propertySymbol) {
448+ return [parameterSymbol, propertySymbol];
449+ }
450+
451+ Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration");
452+ }
453+
433454 function isBlockScopedNameDeclaredBeforeUse(declaration: Declaration, usage: Node): boolean {
434455 const declarationFile = getSourceFileOfNode(declaration);
435456 const useFile = getSourceFileOfNode(usage);
0 commit comments