Skip to content

Commit ec92f7e

Browse files
committed
Merge branch 'skipLibCheck'
2 parents 02c584b + f322def commit ec92f7e

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16383,14 +16383,11 @@ namespace ts {
1638316383
function checkSourceFileWorker(node: SourceFile) {
1638416384
const links = getNodeLinks(node);
1638516385
if (!(links.flags & NodeCheckFlags.TypeChecked)) {
16386-
// Check whether the file has declared it is the default lib,
16387-
// and whether the user has specifically chosen to avoid checking it.
16388-
if (compilerOptions.skipDefaultLibCheck) {
16389-
// If the user specified '--noLib' and a file has a '/// <reference no-default-lib="true"/>',
16390-
// then we should treat that file as a default lib.
16391-
if (node.hasNoDefaultLib) {
16392-
return;
16393-
}
16386+
// If skipLibCheck is enabled, skip type checking if file is a declaration file.
16387+
// If skipDefaultLibCheck is enabled, skip type checking if file contains a
16388+
// '/// <reference no-default-lib="true"/>' directive.
16389+
if (compilerOptions.skipLibCheck && node.isDeclarationFile || compilerOptions.skipDefaultLibCheck && node.hasNoDefaultLib) {
16390+
return;
1639416391
}
1639516392

1639616393
// Grammar checking

src/compiler/commandLineParser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ namespace ts {
139139
name: "skipDefaultLibCheck",
140140
type: "boolean",
141141
},
142+
{
143+
name: "skipLibCheck",
144+
type: "boolean",
145+
description: Diagnostics.Skip_type_checking_of_declaration_files,
146+
},
142147
{
143148
name: "out",
144149
type: "string",

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,6 +2348,10 @@
23482348
"category": "Message",
23492349
"code": 6011
23502350
},
2351+
"Skip type checking of declaration files.": {
2352+
"category": "Message",
2353+
"code": 6012
2354+
},
23512355
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015'": {
23522356
"category": "Message",
23532357
"code": 6015

src/compiler/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,6 +2505,7 @@ namespace ts {
25052505
allowJs?: boolean;
25062506
noImplicitUseStrict?: boolean;
25072507
strictNullChecks?: boolean;
2508+
skipLibCheck?: boolean;
25082509
listEmittedFiles?: boolean;
25092510
lib?: string[];
25102511
/* @internal */ stripInternal?: boolean;

0 commit comments

Comments
 (0)