@fimbul/mimir
Advanced tools
Comparing version 0.21.0-dev.20190412 to 0.21.0-dev.20190507
{ | ||
"name": "@fimbul/mimir", | ||
"version": "0.21.0-dev.20190412", | ||
"version": "0.21.0-dev.20190507", | ||
"description": "Core rules of the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "main": "recommended.yaml", |
@@ -60,2 +60,3 @@ "use strict"; | ||
case ts.SyntaxKind.CallExpression: | ||
case ts.SyntaxKind.NewExpression: | ||
expr = node.expression; | ||
@@ -69,3 +70,3 @@ break; | ||
} | ||
const signatures = this.checker.getTypeAtLocation(expr).getCallSignatures(); | ||
const signatures = this.checker.getSignaturesOfType(this.checker.getTypeAtLocation(expr), node.kind === ts.SyntaxKind.NewExpression ? ts.SignatureKind.Construct : ts.SignatureKind.Call); | ||
// abort if not all signatures have type parameters: | ||
@@ -101,5 +102,7 @@ // higher order function type inference only works for a single call signature | ||
// There is an explicitly declared construct signature | ||
const typeParameters = ts.getEffectiveTypeParameterDeclarations(signature.declaration); | ||
let typeParameters = ts.getEffectiveTypeParameterDeclarations(signature.declaration).map(mapTypeParameterDeclaration); | ||
if (typeParameters.length === 0) | ||
typeParameters = this.getTypeParametersOfCallSignature(node); | ||
if (typeParameters.length !== 0) // only check the signature if it declares type parameters | ||
return this.checkInferredTypeParameters(signature, typeParameters.map(mapTypeParameterDeclaration), node); | ||
return this.checkInferredTypeParameters(signature, typeParameters, node); | ||
if (signature.declaration.kind !== ts.SyntaxKind.Constructor) | ||
@@ -106,0 +109,0 @@ return; // don't look for type parameters on non-class parents |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
419902
4944