-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forbid augmentation of untyped module
- Loading branch information
Andy Hanson
committed
Oct 31, 2016
1 parent
44ce59d
commit b1c0282
Showing
5 changed files
with
73 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/untypedModuleImport_withAugmentation.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/a.ts(1,16): error TS2665: Invalid module name in augmentation, module 'foo' resolves to an untyped module at '/node_modules/foo/index.js', which cannot be augmented. | ||
|
||
|
||
==== /a.ts (1 errors) ==== | ||
declare module "foo" { | ||
~~~~~ | ||
!!! error TS2665: Invalid module name in augmentation, module 'foo' resolves to an untyped module at '/node_modules/foo/index.js', which cannot be augmented. | ||
export const x: number; | ||
} | ||
import { x } from "foo"; | ||
x; | ||
|
||
==== /node_modules/foo/index.js (0 errors) ==== | ||
// This tests that augmenting an untyped module is forbidden. | ||
|
||
This file is not processed. | ||
|
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/untypedModuleImport_withAugmentation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//// [tests/cases/conformance/moduleResolution/untypedModuleImport_withAugmentation.ts] //// | ||
|
||
//// [index.js] | ||
// This tests that augmenting an untyped module is forbidden. | ||
|
||
This file is not processed. | ||
|
||
//// [a.ts] | ||
declare module "foo" { | ||
export const x: number; | ||
} | ||
import { x } from "foo"; | ||
x; | ||
|
||
|
||
//// [a.js] | ||
"use strict"; | ||
var foo_1 = require("foo"); | ||
foo_1.x; |
13 changes: 13 additions & 0 deletions
13
tests/cases/conformance/moduleResolution/untypedModuleImport_withAugmentation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// @noImplicitReferences: true | ||
// @currentDirectory: / | ||
// This tests that augmenting an untyped module is forbidden. | ||
|
||
// @filename: /node_modules/foo/index.js | ||
This file is not processed. | ||
|
||
// @filename: /a.ts | ||
declare module "foo" { | ||
export const x: number; | ||
} | ||
import { x } from "foo"; | ||
x; |