Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fimbul/mimir

Package Overview
Dependencies
Maintainers
2
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fimbul/mimir - npm Package Compare versions

Comparing version 0.18.0 to 0.19.0-dev.20190111

4

package.json
{
"name": "@fimbul/mimir",
"version": "0.18.0",
"version": "0.19.0-dev.20190111",
"description": "Core rules of the Fimbullinter project",

@@ -28,3 +28,3 @@ "main": "recommended.yaml",

"dependencies": {
"@fimbul/ymir": "^0.18.0",
"@fimbul/ymir": "0.18.0",
"chalk": "^2.3.2",

@@ -31,0 +31,0 @@ "debug": "^4.0.0",

@@ -15,2 +15,3 @@ import { TypedRule } from '@fimbul/ymir';

private matchIntersectionType;
private getTypeOfExpression;
}

@@ -7,2 +7,3 @@ "use strict";

const tsutils_1 = require("tsutils");
const utils_1 = require("../utils");
const primitiveFlags = ts.TypeFlags.BigIntLike | ts.TypeFlags.BooleanLike | ts.TypeFlags.NumberLike | ts.TypeFlags.StringLike |

@@ -131,3 +132,3 @@ ts.TypeFlags.ESSymbolLike | ts.TypeFlags.Undefined | ts.TypeFlags.Void;

}
return this.executePredicate(this.checker.getTypeAtLocation(node), truthyFalsy);
return this.executePredicate(this.getTypeOfExpression(node), truthyFalsy);
}

@@ -157,3 +158,3 @@ isConstantComparison(left, right, operator) {

else {
let type = this.checker.getTypeAtLocation(right);
let type = this.getTypeOfExpression(right);
type = this.checker.getBaseConstraintOfType(type) || type;

@@ -187,3 +188,3 @@ if ((type.flags & ts.TypeFlags.StringLiteral) === 0)

}
return this.nullAwarePredicate(this.checker.getTypeAtLocation(left), predicate);
return this.nullAwarePredicate(this.getTypeOfExpression(left), predicate);
}

@@ -238,2 +239,24 @@ nullAwarePredicate(type, predicate) {

}
getTypeOfExpression(node) {
const type = this.checker.getTypeAtLocation(node);
if (!this.strictNullChecks)
return type;
if (tsutils_1.unionTypeParts(type).some((t) => (t.flags & ts.TypeFlags.Undefined) !== 0))
return type;
if (!tsutils_1.isPropertyAccessExpression(node) && !tsutils_1.isElementAccessExpression(node))
return type;
const objectType = this.checker.getApparentType(this.checker.getTypeAtLocation(node.expression));
if (objectType.getStringIndexType() === undefined && objectType.getNumberIndexType() === undefined)
return type;
if (tsutils_1.isPropertyAccessExpression(node)) {
if (objectType.getProperty(node.name.text) !== undefined)
return type;
}
else {
const names = utils_1.lateBoundPropertyNames(node.argumentExpression, this.checker);
if (names.known && names.properties.every(({ symbolName }) => utils_1.getPropertyOfType(objectType, symbolName) !== undefined))
return type;
}
return this.checker.getNullableType(type, ts.TypeFlags.Undefined);
}
};

@@ -240,0 +263,0 @@ Rule = tslib_1.__decorate([

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc