mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 03:23:08 -06:00
Fix isConstructorParameter
This commit is contained in:
parent
84b894769e
commit
6aecd43d9a
@ -4427,10 +4427,17 @@ namespace ts {
|
||||
error(node, Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface);
|
||||
return unknownType;
|
||||
|
||||
function isConstructorParameter(node: TypeNode, container: Node) {
|
||||
function isConstructorParameter(node: Node, container: Node) {
|
||||
if (container.kind === SyntaxKind.Constructor) {
|
||||
let ctor = (<ConstructorDeclaration>container);
|
||||
return !ctor.body.statements.some(st => st === node.parent);
|
||||
while (node && node !== ctor) {
|
||||
if (node === ctor.body) {
|
||||
return false;
|
||||
}
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user