Skip to content

Commit 1f93526

Browse files
committed
Assert that enclosing declaration is not synthesized
1 parent aa59a69 commit 1f93526

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,18 +2444,21 @@ namespace ts {
24442444
function createNodeBuilder() {
24452445
return {
24462446
typeToTypeNode: (type: Type, enclosingDeclaration?: Node, flags?: NodeBuilderFlags) => {
2447+
Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & NodeFlags.Synthesized) === 0);
24472448
const context = createNodeBuilderContext(enclosingDeclaration, flags);
24482449
const resultingNode = typeToTypeNodeHelper(type, context);
24492450
const result = context.encounteredError ? undefined : resultingNode;
24502451
return result;
24512452
},
24522453
indexInfoToIndexSignatureDeclaration: (indexInfo: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags) => {
2454+
Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & NodeFlags.Synthesized) === 0);
24532455
const context = createNodeBuilderContext(enclosingDeclaration, flags);
24542456
const resultingNode = indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context);
24552457
const result = context.encounteredError ? undefined : resultingNode;
24562458
return result;
24572459
},
24582460
signatureToSignatureDeclaration: (signature: Signature, kind: SyntaxKind, enclosingDeclaration?: Node, flags?: NodeBuilderFlags) => {
2461+
Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & NodeFlags.Synthesized) === 0);
24592462
const context = createNodeBuilderContext(enclosingDeclaration, flags);
24602463
const resultingNode = signatureToSignatureDeclarationHelper(signature, kind, context);
24612464
const result = context.encounteredError ? undefined : resultingNode;

0 commit comments

Comments
 (0)