forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmoduleAugmentationInAmbientModule5.js
More file actions
62 lines (45 loc) · 1.16 KB
/
moduleAugmentationInAmbientModule5.js
File metadata and controls
62 lines (45 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//// [tests/cases/compiler/moduleAugmentationInAmbientModule5.ts] ////
//// [array.d.ts]
declare module "A" {
class A { x: number; }
}
declare module "array" {
import {A} from "A";
global {
interface Array<T> {
getA(): A;
}
}
}
//// [f.ts]
/// <reference path="array.d.ts"/>
import "array";
let x = [1];
let y = x.getA().x;
//// [f.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/// <reference path="array.d.ts"/>
require("array");
var x = [1];
var y = x.getA().x;
//// [f.d.ts]
import "array";
//// [DtsFileErrors]
f.d.ts(1,8): error TS2882: Cannot find module or type declarations for side-effect import of 'array'.
==== f.d.ts (1 errors) ====
import "array";
~~~~~~~
!!! error TS2882: Cannot find module or type declarations for side-effect import of 'array'.
==== array.d.ts (0 errors) ====
declare module "A" {
class A { x: number; }
}
declare module "array" {
import {A} from "A";
global {
interface Array<T> {
getA(): A;
}
}
}