type-coverage-core
Advanced tools
Comparing version 2.26.3 to 2.27.1
@@ -23,7 +23,7 @@ import * as ts from 'typescript'; | ||
export declare const enum FileAnyInfoKind { | ||
any = 1, | ||
containsAny = 2, | ||
unsafeAs = 3, | ||
unsafeTypeAssertion = 4, | ||
unsafeNonNull = 5, | ||
any = 1,// any | ||
containsAny = 2,// Promise<any> | ||
unsafeAs = 3,// foo as string | ||
unsafeTypeAssertion = 4,// <string>foo | ||
unsafeNonNull = 5,// foo! | ||
semanticError = 6 | ||
@@ -30,0 +30,0 @@ } |
@@ -107,25 +107,32 @@ "use strict"; | ||
if (config.extends) { | ||
let project; | ||
let fallbackProjects = []; | ||
if (path.isAbsolute(config.extends)) { | ||
project = config.extends; | ||
let lastBasename = dirname; | ||
const extendsArray = Array.isArray(config.extends) ? config.extends : [config.extends]; | ||
let extendsCompilerOptions = {}; | ||
for (const extend of extendsArray) { | ||
let project; | ||
let fallbackProjects = []; | ||
if (path.isAbsolute(extend)) { | ||
project = extend; | ||
} | ||
else if (extend === '.' | ||
|| extend === '..' | ||
|| extend.startsWith(`.${path.sep}`) | ||
|| extend.startsWith(`..${path.sep}`) | ||
|| extend.startsWith('./') | ||
|| extend.startsWith('../')) { | ||
project = path.resolve(dirname, extend); | ||
} | ||
else { | ||
project = path.resolve(dirname, 'node_modules', extend); | ||
const paths = await findParentsWithNodeModules(dirname); | ||
fallbackProjects = paths.map(p => path.resolve(p, 'node_modules', extend || '')); | ||
} | ||
const { configFilePath, dirname: extendsBasename } = getTsConfigFilePath(project, fallbackProjects); | ||
lastBasename = extendsBasename; | ||
const extendsConfig = await getTsConfig(configFilePath, extendsBasename); | ||
extendsCompilerOptions = { ...extendsCompilerOptions, ...extendsConfig.compilerOptions }; | ||
} | ||
else if (config.extends === '.' | ||
|| config.extends === '..' | ||
|| config.extends.startsWith(`.${path.sep}`) | ||
|| config.extends.startsWith(`..${path.sep}`) | ||
|| config.extends.startsWith('./') | ||
|| config.extends.startsWith('../')) { | ||
project = path.resolve(dirname, config.extends); | ||
} | ||
else { | ||
project = path.resolve(dirname, 'node_modules', config.extends); | ||
const paths = await findParentsWithNodeModules(dirname); | ||
fallbackProjects = paths.map(p => path.resolve(p, 'node_modules', config.extends || '')); | ||
} | ||
const { configFilePath, dirname: extendsBasename } = getTsConfigFilePath(project, fallbackProjects); | ||
const extendsConfig = await getTsConfig(configFilePath, extendsBasename); | ||
config.compilerOptions = { ...extendsCompilerOptions, ...config.compilerOptions }; | ||
const topLevelBaseUrl = config.compilerOptions ? config.compilerOptions.baseUrl : undefined; | ||
config.compilerOptions = { ...extendsConfig.compilerOptions, ...config.compilerOptions }; | ||
config.basePath = topLevelBaseUrl ? dirname : extendsBasename; | ||
config.basePath = topLevelBaseUrl ? dirname : lastBasename; | ||
} | ||
@@ -132,0 +139,0 @@ return config; |
{ | ||
"name": "type-coverage-core", | ||
"version": "2.26.3", | ||
"version": "2.27.1", | ||
"description": "A library to check type coverage for typescript code", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
58966
1642