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

type-coverage

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-coverage - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

27

dist/core.js

@@ -8,3 +8,3 @@ "use strict";

// tslint:disable-next-line:no-big-function
async function lint(project, detail, debug, files, oldProgram, strict) {
async function lint(project, detail, debug, files, oldProgram, strict = false) {
const { configFilePath, dirname } = tsconfig_1.getTsConfigFilePath(project);

@@ -42,14 +42,5 @@ const config = tsconfig_1.getTsConfig(configFilePath, dirname);

totalCount++;
if (typeIsAny(type)) {
if (typeIsStrictAny(type, strict)) {
collectAny(node, file, sourceFile);
}
else if (strict && type.flags === typescript_1.default.TypeFlags.Object) {
const typeArguments = type.typeArguments;
if (typeArguments && typeArguments.some((ypeArgument) => typeIsAny(ypeArgument))) {
collectAny(node, file, sourceFile);
}
else {
collectNotAny(node, file, sourceFile, type);
}
}
else {

@@ -79,2 +70,3 @@ collectNotAny(node, file, sourceFile, type);

handleNodes(node.modifiers, file, sourceFile);
// tslint:disable-next-line:max-switch-cases
switch (node.kind) {

@@ -911,4 +903,13 @@ case typescript_1.default.SyntaxKind.Unknown:

exports.lint = lint;
function typeIsAny(type) {
return type.flags === 1 && type.intrinsicName === 'any';
function typeIsStrictAny(type, strict) {
if (type.flags === typescript_1.default.TypeFlags.Any) {
return type.intrinsicName === 'any';
}
if (strict && type.flags === typescript_1.default.TypeFlags.Object) {
const typeArguments = type.typeArguments;
if (typeArguments) {
return typeArguments.some((typeArgument) => typeIsStrictAny(typeArgument, strict));
}
}
return false;
}
{
"name": "type-coverage",
"version": "1.7.0",
"version": "1.8.0",
"description": "A CLI tool to check type coverage for typescript code",

@@ -14,3 +14,3 @@ "main": "dist/core.js",

"@types/glob": "7.1.1",
"@types/jasmine": "3.3.7",
"@types/jasmine": "3.3.8",
"@types/minimist": "1.2.0",

@@ -27,3 +27,3 @@ "@types/node": "10.12.18",

"tslint-config-standard": "8.0.1",
"tslint-sonarts": "1.8.0"
"tslint-sonarts": "1.9.0"
},

@@ -30,0 +30,0 @@ "dependencies": {

@@ -31,3 +31,3 @@ # type-coverage

--debug | boolean? | show debug info
--strict | boolean? | if the identifiers' type arguments exist and contain at least one `any`, like `any[]`, `ReadonlyArray<any>`, `Promise<any>`, `Foo<number, any>`, is will considered as `any` too; also, future minor release may introduce stricter type check in this mode, which may lower the code coverage
--strict | boolean? | if the identifiers' type arguments exist and contain at least one `any`, like `any[]`, `ReadonlyArray<any>`, `Promise<any>`, `Foo<number, any>`, it will be considered as `any` too; also, future minor release may introduce stricter type check in this mode, which may lower the code coverage

@@ -34,0 +34,0 @@ ## config in package.json

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