type-coverage-core
Advanced tools
Comparing version 2.21.2 to 2.22.0
@@ -113,2 +113,3 @@ "use strict"; | ||
ignoreEmptyType: lintOptions.ignoreEmptyType, | ||
reportSemanticError: lintOptions.reportSemanticError, | ||
}; | ||
@@ -121,2 +122,25 @@ sourceFile.forEachChild(node => { | ||
anys.push(...context.typeCheckResult.anys.map((a) => ({ file, ...a }))); | ||
if (lintOptions.reportSemanticError) { | ||
const diagnostics = program.getSemanticDiagnostics(sourceFile); | ||
for (const diagnostic of diagnostics) { | ||
if (diagnostic.start !== undefined) { | ||
totalCount++; | ||
let text; | ||
if (typeof diagnostic.messageText === 'string') { | ||
text = diagnostic.messageText; | ||
} | ||
else { | ||
text = diagnostic.messageText.messageText; | ||
} | ||
const { line, character } = ts.getLineAndCharacterOfPosition(sourceFile, diagnostic.start); | ||
anys.push({ | ||
line, | ||
character, | ||
text, | ||
kind: 6 /* FileAnyInfoKind.semanticError */, | ||
file, | ||
}); | ||
} | ||
} | ||
} | ||
if (lintOptions.fileCounts) { | ||
@@ -166,2 +190,3 @@ fileCounts.set(file, { | ||
ignoreEmptyType: false, | ||
reportSemanticError: false, | ||
}; | ||
@@ -229,2 +254,3 @@ /** | ||
ignoreEmptyType: lintOptions.ignoreEmptyType, | ||
reportSemanticError: lintOptions.reportSemanticError, | ||
}; | ||
@@ -231,0 +257,0 @@ sourceFile.forEachChild(node => { |
@@ -27,3 +27,4 @@ import * as ts from 'typescript'; | ||
unsafeTypeAssertion = 4, | ||
unsafeNonNull = 5 | ||
unsafeNonNull = 5, | ||
semanticError = 6 | ||
} | ||
@@ -72,2 +73,3 @@ /** | ||
ignoreEmptyType: boolean; | ||
reportSemanticError: boolean; | ||
} | ||
@@ -74,0 +76,0 @@ export interface FileContext extends CommonOptions { |
{ | ||
"name": "type-coverage-core", | ||
"version": "2.21.2", | ||
"version": "2.22.0", | ||
"description": "A library to check type coverage for typescript code", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
58145
1629