Skip to content

Skip files with no-default-lib when '--skipDefaultLibCheck' are used #5511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14058,8 +14058,12 @@ namespace ts {
if (!(links.flags & NodeCheckFlags.TypeChecked)) {
// Check whether the file has declared it is the default lib,
// and whether the user has specifically chosen to avoid checking it.
if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) {
return;
if (compilerOptions.skipDefaultLibCheck) {
// If the user specified '--noLib' and a file has a '/// <reference no-default-lib="true"/>',
// then we should treat that file as a default lib.
if (node.hasNoDefaultLib) {
return;
}
}

// Grammar checking
Expand Down
1 change: 0 additions & 1 deletion src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,6 @@ namespace ts {
processImportedModules(file, basePath);

if (isDefaultLib) {
file.isDefaultLib = true;
files.unshift(file);
}
else {
Expand Down
1 change: 0 additions & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,6 @@ namespace ts {
// The first node that causes this file to be an external module
/* @internal */ externalModuleIndicator: Node;

/* @internal */ isDefaultLib: boolean;
/* @internal */ identifiers: Map<string>;
/* @internal */ nodeCount: number;
/* @internal */ identifierCount: number;
Expand Down
29 changes: 6 additions & 23 deletions tests/baselines/reference/typeCheckTypeArgument.errors.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
error TS2318: Cannot find global type 'Array'.
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'Function'.
error TS2318: Cannot find global type 'IArguments'.
error TS2318: Cannot find global type 'Number'.
error TS2318: Cannot find global type 'Object'.
error TS2318: Cannot find global type 'RegExp'.
error TS2318: Cannot find global type 'String'.
tests/cases/compiler/typeCheckTypeArgument.ts(3,19): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(5,26): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(7,21): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(9,24): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(12,22): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(15,13): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(2,19): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(4,26): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(6,21): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(8,24): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(11,22): error TS2304: Cannot find name 'UNKNOWN'.
tests/cases/compiler/typeCheckTypeArgument.ts(14,13): error TS2304: Cannot find name 'UNKNOWN'.


!!! error TS2318: Cannot find global type 'Array'.
!!! error TS2318: Cannot find global type 'Boolean'.
!!! error TS2318: Cannot find global type 'Function'.
!!! error TS2318: Cannot find global type 'IArguments'.
!!! error TS2318: Cannot find global type 'Number'.
!!! error TS2318: Cannot find global type 'Object'.
!!! error TS2318: Cannot find global type 'RegExp'.
!!! error TS2318: Cannot find global type 'String'.
==== tests/cases/compiler/typeCheckTypeArgument.ts (6 errors) ====
/// <reference no-default-lib="true"/>

var f: <T extends UNKNOWN>() => void;
~~~~~~~
Expand Down
2 changes: 0 additions & 2 deletions tests/baselines/reference/typeCheckTypeArgument.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//// [typeCheckTypeArgument.ts]
/// <reference no-default-lib="true"/>

var f: <T extends UNKNOWN>() => void;

Expand All @@ -16,7 +15,6 @@ class Foo2 {
(<T extends UNKNOWN>(a) => { });

//// [typeCheckTypeArgument.js]
/// <reference no-default-lib="true"/>
var f;
var Foo = (function () {
function Foo() {
Expand Down
1 change: 0 additions & 1 deletion tests/cases/compiler/typeCheckTypeArgument.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/// <reference no-default-lib="true"/>

var f: <T extends UNKNOWN>() => void;

Expand Down