-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
no-inferred-empty-object: check tagged templates (#213)
Fixes: #190
- Loading branch information
Showing
4 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,16 +18,20 @@ export class Rule extends TypedRule { | |
} else if (node.kind === ts.SyntaxKind.NewExpression) { | ||
if ((<ts.NewExpression>node).typeArguments === undefined) | ||
this.checkNewExpression(<ts.NewExpression>node); | ||
} else if (!typescriptPre290 && // passing type arguments to JSX elements is only possible starting from [email protected] | ||
(node.kind === ts.SyntaxKind.JsxOpeningElement || node.kind === ts.SyntaxKind.JsxSelfClosingElement) && | ||
} else if (!typescriptPre290 && // type arguments on JSX elements and tagged templates was introduced in [email protected] | ||
( | ||
node.kind === ts.SyntaxKind.JsxOpeningElement || | ||
node.kind === ts.SyntaxKind.JsxSelfClosingElement || | ||
node.kind === ts.SyntaxKind.TaggedTemplateExpression | ||
) && | ||
// TODO fix assertion on upgrade to [email protected] | ||
(<any>node).typeArguments === undefined) { | ||
this.checkCallExpression(<ts.JsxOpeningLikeElement>node); | ||
} | ||
} | ||
} | ||
|
||
private checkCallExpression(node: ts.CallExpression | ts.JsxOpeningLikeElement) { | ||
private checkCallExpression(node: ts.CallExpression | ts.JsxOpeningLikeElement | ts.TaggedTemplateExpression) { | ||
const signature = this.checker.getResolvedSignature(node); | ||
// wotan-disable-next-line no-useless-predicate | ||
if (signature.declaration !== undefined) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters