Add regression tests documenting current behavior of #14121 (#22748)

This commit is contained in:
Wesley Wigham
2018-03-29 11:01:05 -07:00
committed by GitHub
parent 65659d7297
commit 5c49133382
4 changed files with 130 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
//// [tests/cases/compiler/exportAssignmentMembersVisibleInAugmentation.ts] ////
//// [index.d.ts]
export = foo;
declare namespace foo {
export type T = number;
}
//// [a.ts]
import * as foo from "foo";
declare module "foo" {
export function f(): T; // OK
}
//// [b.ts]
import * as foo from "foo";
declare module "foo" {
export function g(): foo.T; // OK
}
//// [a.js]
"use strict";
exports.__esModule = true;
//// [b.js]
"use strict";
exports.__esModule = true;
//// [a.d.ts]
declare module "foo" {
function f(): T;
}
export {};
//// [b.d.ts]
import * as foo from "foo";
declare module "foo" {
function g(): foo.T;
}

View File

@@ -0,0 +1,36 @@
=== /node_modules/foo/index.d.ts ===
export = foo;
>foo : Symbol(foo, Decl(index.d.ts, 0, 13))
declare namespace foo {
>foo : Symbol(foo, Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
export type T = number;
>T : Symbol(T, Decl(index.d.ts, 1, 23))
}
=== /a.ts ===
import * as foo from "foo";
>foo : Symbol(foo, Decl(a.ts, 0, 6))
declare module "foo" {
>"foo" : Symbol(foo, Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
export function f(): T; // OK
>f : Symbol(f, Decl(a.ts, 1, 22))
>T : Symbol(T, Decl(index.d.ts, 1, 23))
}
=== /b.ts ===
import * as foo from "foo";
>foo : Symbol(foo, Decl(b.ts, 0, 6))
declare module "foo" {
>"foo" : Symbol(foo, Decl(index.d.ts, 0, 13), Decl(a.ts, 0, 27), Decl(b.ts, 0, 27))
export function g(): foo.T; // OK
>g : Symbol(g, Decl(b.ts, 1, 22))
>foo : Symbol(foo, Decl(b.ts, 0, 6))
>T : Symbol(T, Decl(index.d.ts, 1, 23))
}

View File

@@ -0,0 +1,36 @@
=== /node_modules/foo/index.d.ts ===
export = foo;
>foo : any
declare namespace foo {
>foo : typeof foo
export type T = number;
>T : number
}
=== /a.ts ===
import * as foo from "foo";
>foo : typeof foo
declare module "foo" {
>"foo" : typeof foo
export function f(): T; // OK
>f : () => number
>T : number
}
=== /b.ts ===
import * as foo from "foo";
>foo : typeof foo
declare module "foo" {
>"foo" : typeof foo
export function g(): foo.T; // OK
>g : () => number
>foo : any
>T : number
}

View File

@@ -0,0 +1,19 @@
// @declaration: true
// @Filename: /node_modules/foo/index.d.ts
export = foo;
declare namespace foo {
export type T = number;
}
// @Filename: /a.ts
import * as foo from "foo";
declare module "foo" {
export function f(): T; // OK
}
// @Filename: /b.ts
import * as foo from "foo";
declare module "foo" {
export function g(): foo.T; // OK
}