Skip to content

Commit 7b660c8

Browse files
committed
Test: no declare in declaration tmp in namespace
1 parent 03bca49 commit 7b660c8

File tree

4 files changed

+155
-0
lines changed

4 files changed

+155
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//// [declarationEmitExpressionInExtends5.ts]
2+
namespace Test
3+
{
4+
export interface IFace
5+
{
6+
}
7+
8+
export class SomeClass implements IFace
9+
{
10+
}
11+
12+
export class Derived extends getClass<IFace>()
13+
{
14+
}
15+
16+
export function getClass<T>() : new() => T
17+
{
18+
return SomeClass as (new() => T);
19+
}
20+
}
21+
22+
23+
//// [declarationEmitExpressionInExtends5.js]
24+
var __extends = (this && this.__extends) || (function () {
25+
var extendStatics = Object.setPrototypeOf ||
26+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
27+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
28+
return function (d, b) {
29+
extendStatics(d, b);
30+
function __() { this.constructor = d; }
31+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32+
};
33+
})();
34+
var Test;
35+
(function (Test) {
36+
var SomeClass = (function () {
37+
function SomeClass() {
38+
}
39+
return SomeClass;
40+
}());
41+
Test.SomeClass = SomeClass;
42+
var Derived = (function (_super) {
43+
__extends(Derived, _super);
44+
function Derived() {
45+
return _super !== null && _super.apply(this, arguments) || this;
46+
}
47+
return Derived;
48+
}(getClass()));
49+
Test.Derived = Derived;
50+
function getClass() {
51+
return SomeClass;
52+
}
53+
Test.getClass = getClass;
54+
})(Test || (Test = {}));
55+
56+
57+
//// [declarationEmitExpressionInExtends5.d.ts]
58+
declare namespace Test {
59+
interface IFace {
60+
}
61+
class SomeClass implements IFace {
62+
}
63+
const Derived_base: new () => IFace;
64+
class Derived extends Derived_base {
65+
}
66+
function getClass<T>(): new () => T;
67+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
=== tests/cases/compiler/declarationEmitExpressionInExtends5.ts ===
2+
namespace Test
3+
>Test : Symbol(Test, Decl(declarationEmitExpressionInExtends5.ts, 0, 0))
4+
{
5+
export interface IFace
6+
>IFace : Symbol(IFace, Decl(declarationEmitExpressionInExtends5.ts, 1, 1))
7+
{
8+
}
9+
10+
export class SomeClass implements IFace
11+
>SomeClass : Symbol(SomeClass, Decl(declarationEmitExpressionInExtends5.ts, 4, 2))
12+
>IFace : Symbol(IFace, Decl(declarationEmitExpressionInExtends5.ts, 1, 1))
13+
{
14+
}
15+
16+
export class Derived extends getClass<IFace>()
17+
>Derived : Symbol(Derived, Decl(declarationEmitExpressionInExtends5.ts, 8, 2))
18+
>getClass : Symbol(getClass, Decl(declarationEmitExpressionInExtends5.ts, 12, 2))
19+
>IFace : Symbol(IFace, Decl(declarationEmitExpressionInExtends5.ts, 1, 1))
20+
{
21+
}
22+
23+
export function getClass<T>() : new() => T
24+
>getClass : Symbol(getClass, Decl(declarationEmitExpressionInExtends5.ts, 12, 2))
25+
>T : Symbol(T, Decl(declarationEmitExpressionInExtends5.ts, 14, 26))
26+
>T : Symbol(T, Decl(declarationEmitExpressionInExtends5.ts, 14, 26))
27+
{
28+
return SomeClass as (new() => T);
29+
>SomeClass : Symbol(SomeClass, Decl(declarationEmitExpressionInExtends5.ts, 4, 2))
30+
>T : Symbol(T, Decl(declarationEmitExpressionInExtends5.ts, 14, 26))
31+
}
32+
}
33+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
=== tests/cases/compiler/declarationEmitExpressionInExtends5.ts ===
2+
namespace Test
3+
>Test : typeof Test
4+
{
5+
export interface IFace
6+
>IFace : IFace
7+
{
8+
}
9+
10+
export class SomeClass implements IFace
11+
>SomeClass : SomeClass
12+
>IFace : IFace
13+
{
14+
}
15+
16+
export class Derived extends getClass<IFace>()
17+
>Derived : Derived
18+
>getClass<IFace>() : IFace
19+
>getClass : <T>() => new () => T
20+
>IFace : IFace
21+
{
22+
}
23+
24+
export function getClass<T>() : new() => T
25+
>getClass : <T>() => new () => T
26+
>T : T
27+
>T : T
28+
{
29+
return SomeClass as (new() => T);
30+
>SomeClass as (new() => T) : new () => T
31+
>SomeClass : typeof SomeClass
32+
>T : T
33+
}
34+
}
35+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @declaration: true
2+
namespace Test
3+
{
4+
export interface IFace
5+
{
6+
}
7+
8+
export class SomeClass implements IFace
9+
{
10+
}
11+
12+
export class Derived extends getClass<IFace>()
13+
{
14+
}
15+
16+
export function getClass<T>() : new() => T
17+
{
18+
return SomeClass as (new() => T);
19+
}
20+
}

0 commit comments

Comments
 (0)