Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Update tuple rule for new AST
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed May 28, 2020
1 parent 452bb3c commit 034d77e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
20 changes: 0 additions & 20 deletions .vscode/launch.json

This file was deleted.

2 changes: 1 addition & 1 deletion src/rules/noSingleElementTupleTypeRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Rule extends Lint.Rules.AbstractRule {
function walk(ctx: Lint.WalkContext<void>): 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[]."));
Expand Down

0 comments on commit 034d77e

Please sign in to comment.