diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 03c2fbd9630..9b3515d3742 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10934,10 +10934,12 @@ module ts { function checkSourceFile(node: SourceFile) { let start = new Date().getTime(); - let skipCheck = node.fileName.indexOf("lib.d.ts") >= 0 && compilerOptions.noLibCheck; + + let skipCheck = node.hasNoDefaultLib && compilerOptions.noLibCheck; if (!skipCheck) { checkSourceFileWorker(node); } + checkTime += new Date().getTime() - start; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2f4e33a6e8b..496153b1513 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1004,6 +1004,14 @@ module ts { amdModuleName: string; referencedFiles: FileReference[]; + /** + * lib.d.ts should have a reference comment like + * + * /// + * + * which serves the purpose of ignoring the file in certain ways in the + * presence of compiler options like '--noLib' and '--noLibCheck'. + */ hasNoDefaultLib: boolean; languageVersion: ScriptTarget; @@ -1042,7 +1050,7 @@ module ts { (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; } - export interface Program extends ScriptReferenceHost { + export interface Program extends ScriptReferenceHost, TypeCheckerHost { /** * Get a list of files in the program */