Skip to content

Commit 90d1335

Browse files
committed
Ignore bad typings properties in package.json files
Otherwise, the non-existent typings file becomes part of the project and a spurious non-existent-root-file error is reported.
1 parent a75f26e commit 90d1335

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/jsTyping/jsTyping.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,13 @@ namespace ts.JsTyping {
293293
const ownTypes = packageJson.types || packageJson.typings;
294294
if (ownTypes) {
295295
const absolutePath = getNormalizedAbsolutePath(ownTypes, getDirectoryPath(normalizedFileName));
296-
if (log) log(` Package '${packageJson.name}' provides its own types.`);
297-
inferredTypings.set(packageJson.name, absolutePath);
296+
if (host.fileExists(absolutePath)) {
297+
if (log) log(` Package '${packageJson.name}' provides its own types.`);
298+
inferredTypings.set(packageJson.name, absolutePath);
299+
}
300+
else {
301+
if (log) log(` Package '${packageJson.name}' provides its own types but they are missing.`);
302+
}
298303
}
299304
else {
300305
packageNames.push(packageJson.name);

0 commit comments

Comments
 (0)