From 034d77ef6f0cb40a6d87b733fbcf5f802a878623 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 27 May 2020 17:22:57 -0700 Subject: [PATCH] Update tuple rule for new AST --- .vscode/launch.json | 20 -------------------- src/rules/noSingleElementTupleTypeRule.ts | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index ca79fc9..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "attach", - "name": "Attach", - "port": 9229, - "sourceMaps": true - }, - { - "type": "node", - "request": "launch", - "name": "Launch Program", - "program": "${workspaceRoot}/test/test.js", - "outFiles": ["${workspaceRoot}/bin"] - } - ] -} \ No newline at end of file diff --git a/src/rules/noSingleElementTupleTypeRule.ts b/src/rules/noSingleElementTupleTypeRule.ts index f627c8d..4c591e3 100644 --- a/src/rules/noSingleElementTupleTypeRule.ts +++ b/src/rules/noSingleElementTupleTypeRule.ts @@ -21,7 +21,7 @@ export class Rule extends Lint.Rules.AbstractRule { function walk(ctx: Lint.WalkContext): void { const { sourceFile } = ctx; sourceFile.forEachChild(function cb(node) { - if (ts.isTupleTypeNode(node) && node.elementTypes.length === 1) { + if (ts.isTupleTypeNode(node) && (node.elements ?? (node as any).elementTypes).length === 1) { ctx.addFailureAtNode(node, failure( Rule.metadata.ruleName, "Type [T] is a single-element tuple type. You probably meant T[]."));