@fimbul/mimir
Advanced tools
Comparing version 0.11.0-dev.20180607 to 0.11.0-dev.20180609
{ | ||
"name": "@fimbul/mimir", | ||
"version": "0.11.0-dev.20180607", | ||
"version": "0.11.0-dev.20180609", | ||
"description": "Core rules of the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "main": "recommended.yaml", |
@@ -86,3 +86,7 @@ "use strict"; | ||
const contextualType = this.getSafeContextualType(node); | ||
if (contextualType === undefined || !typesAreEqual(sourceType, contextualType, this.checker)) | ||
if (contextualType === undefined || | ||
contextualType.flags & (ts.TypeFlags.TypeVariable | ts.TypeFlags.Instantiable) || | ||
(contextualType.flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) === 0 && | ||
!typesAreEqual(sourceType, contextualType, this.checker) && | ||
!typesAreEqual(sourceType, tsutils_1.removeOptionalityFromType(this.checker, contextualType), this.checker)) | ||
return; | ||
@@ -104,4 +108,14 @@ message = 'This assertion is unnecessary as the receiver accepts the original type of the expression.'; | ||
const parent = node.parent; | ||
if (!tsutils_1.isCallExpression(parent) && !tsutils_1.isNewExpression(parent) || node === parent.expression) | ||
return; | ||
switch (parent.kind) { | ||
case ts.SyntaxKind.CallExpression: | ||
case ts.SyntaxKind.NewExpression: | ||
if (node === parent.expression) | ||
return; | ||
break; | ||
case ts.SyntaxKind.TemplateSpan: | ||
case ts.SyntaxKind.JsxExpression: | ||
break; | ||
default: | ||
return; | ||
} | ||
return this.checker.getContextualType(node); | ||
@@ -108,0 +122,0 @@ } |
Sorry, the diff of this file is not supported yet
345235
3687