mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 07:55:10 -05:00
Improve test and comments
Test asserts that unused locals error works for untyped modules. Comment no longer claims to check for untyped modules.
This commit is contained in:
@@ -438,7 +438,7 @@ namespace ts {
|
||||
((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral || isGlobalScopeAugmentation(<ModuleDeclaration>node));
|
||||
}
|
||||
|
||||
/** Given a symbol for a module, checks that it is either an untyped import or a shorthand ambient module. */
|
||||
/** Given a symbol for a module, checks that it is a shorthand ambient module. */
|
||||
export function isShorthandAmbientModuleSymbol(moduleSymbol: Symbol): boolean {
|
||||
return isShorthandAmbientModule(moduleSymbol.valueDeclaration);
|
||||
}
|
||||
|
||||
18
tests/baselines/reference/extendsUntypedModule.errors.txt
Normal file
18
tests/baselines/reference/extendsUntypedModule.errors.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
/a.ts(2,8): error TS6133: 'Bar' is declared but never used.
|
||||
|
||||
|
||||
==== /a.ts (1 errors) ====
|
||||
import Foo from "foo";
|
||||
import Bar from "bar"; // error: unused
|
||||
~~~
|
||||
!!! error TS6133: 'Bar' is declared but never used.
|
||||
export class A extends Foo { }
|
||||
|
||||
==== /node_modules/foo/index.js (0 errors) ====
|
||||
// Test that extending an untyped module is an error, unlike extending unknownSymbol.
|
||||
|
||||
This file is not read.
|
||||
|
||||
==== /node_modules/bar/index.js (0 errors) ====
|
||||
Nor is this one.
|
||||
|
||||
@@ -5,9 +5,13 @@
|
||||
|
||||
This file is not read.
|
||||
|
||||
//// [index.js]
|
||||
Nor is this one.
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "foo";
|
||||
class A extends Foo { }
|
||||
import Bar from "bar"; // error: unused
|
||||
export class A extends Foo { }
|
||||
|
||||
|
||||
//// [a.js]
|
||||
@@ -31,3 +35,4 @@ var A = (function (_super) {
|
||||
}
|
||||
return A;
|
||||
}(foo_1["default"]));
|
||||
exports.A = A;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
=== /a.ts ===
|
||||
import Foo from "foo";
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
class A extends Foo { }
|
||||
>A : Symbol(A, Decl(a.ts, 0, 22))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
=== /a.ts ===
|
||||
import Foo from "foo";
|
||||
>Foo : any
|
||||
|
||||
class A extends Foo { }
|
||||
>A : A
|
||||
>Foo : any
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
// Test that extending an untyped module is an error, unlike extending unknownSymbol.
|
||||
// @noImplicitReferences: true
|
||||
// @noUnusedLocals: true
|
||||
|
||||
// @Filename: /node_modules/foo/index.js
|
||||
This file is not read.
|
||||
|
||||
// @Filename: /node_modules/bar/index.js
|
||||
Nor is this one.
|
||||
|
||||
// @Filename: /a.ts
|
||||
import Foo from "foo";
|
||||
class A extends Foo { }
|
||||
import Bar from "bar"; // error: unused
|
||||
export class A extends Foo { }
|
||||
|
||||
Reference in New Issue
Block a user