fix(compiler-cli): do not validate metadata from declaration files (#19324)

Upgrading metadata files causes spurious reports of metadata errors.

Fixes #18867
This commit is contained in:
Chuck Jazdzewski
2017-09-25 12:36:08 -07:00
committed by Victor Berchet
parent 68078fd620
commit 476790290e
2 changed files with 39 additions and 1 deletions

View File

@ -322,8 +322,14 @@ export class LowerMetadataCache implements RequestsMap {
return value;
};
// Do not validate or lower metadata in a declaration file. Declaration files are requested
// when we need to update the version of the metadata to add informatoin that might be missing
// in the out-of-date version that can be recovered from the .d.ts file.
const declarationFile = sourceFile.isDeclarationFile;
const metadata = this.collector.getMetadata(
sourceFile, this.strict, sourceFile.isDeclarationFile ? undefined : substituteExpression);
sourceFile, this.strict && !declarationFile,
declarationFile ? undefined : substituteExpression);
return {metadata, requests};
}