Test: no declare in declaration tmp in namespace

This commit is contained in:
Nathan Shively-Sanders 2017-05-10 11:48:32 -07:00
parent 4b4cff5684
commit cf2c88c398
4 changed files with 155 additions and 0 deletions

View File

@ -0,0 +1,67 @@
//// [declarationEmitExpressionInExtends5.ts]
namespace Test
{
export interface IFace
{
}
export class SomeClass implements IFace
{
}
export class Derived extends getClass<IFace>()
{
}
export function getClass<T>() : new() => T
{
return SomeClass as (new() => T);
}
}
//// [declarationEmitExpressionInExtends5.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var Test;
(function (Test) {
var SomeClass = (function () {
function SomeClass() {
}
return SomeClass;
}());
Test.SomeClass = SomeClass;
var Derived = (function (_super) {
__extends(Derived, _super);
function Derived() {
return _super !== null && _super.apply(this, arguments) || this;
}
return Derived;
}(getClass()));
Test.Derived = Derived;
function getClass() {
return SomeClass;
}
Test.getClass = getClass;
})(Test || (Test = {}));
//// [declarationEmitExpressionInExtends5.d.ts]
declare namespace Test {
interface IFace {
}
class SomeClass implements IFace {
}
const Derived_base: new () => IFace;
class Derived extends Derived_base {
}
function getClass<T>(): new () => T;
}

View File

@ -0,0 +1,33 @@
=== tests/cases/compiler/declarationEmitExpressionInExtends5.ts ===
namespace Test
>Test : Symbol(Test, Decl(declarationEmitExpressionInExtends5.ts, 0, 0))
{
export interface IFace
>IFace : Symbol(IFace, Decl(declarationEmitExpressionInExtends5.ts, 1, 1))
{
}
export class SomeClass implements IFace
>SomeClass : Symbol(SomeClass, Decl(declarationEmitExpressionInExtends5.ts, 4, 2))
>IFace : Symbol(IFace, Decl(declarationEmitExpressionInExtends5.ts, 1, 1))
{
}
export class Derived extends getClass<IFace>()
>Derived : Symbol(Derived, Decl(declarationEmitExpressionInExtends5.ts, 8, 2))
>getClass : Symbol(getClass, Decl(declarationEmitExpressionInExtends5.ts, 12, 2))
>IFace : Symbol(IFace, Decl(declarationEmitExpressionInExtends5.ts, 1, 1))
{
}
export function getClass<T>() : new() => T
>getClass : Symbol(getClass, Decl(declarationEmitExpressionInExtends5.ts, 12, 2))
>T : Symbol(T, Decl(declarationEmitExpressionInExtends5.ts, 14, 26))
>T : Symbol(T, Decl(declarationEmitExpressionInExtends5.ts, 14, 26))
{
return SomeClass as (new() => T);
>SomeClass : Symbol(SomeClass, Decl(declarationEmitExpressionInExtends5.ts, 4, 2))
>T : Symbol(T, Decl(declarationEmitExpressionInExtends5.ts, 14, 26))
}
}

View File

@ -0,0 +1,35 @@
=== tests/cases/compiler/declarationEmitExpressionInExtends5.ts ===
namespace Test
>Test : typeof Test
{
export interface IFace
>IFace : IFace
{
}
export class SomeClass implements IFace
>SomeClass : SomeClass
>IFace : IFace
{
}
export class Derived extends getClass<IFace>()
>Derived : Derived
>getClass<IFace>() : IFace
>getClass : <T>() => new () => T
>IFace : IFace
{
}
export function getClass<T>() : new() => T
>getClass : <T>() => new () => T
>T : T
>T : T
{
return SomeClass as (new() => T);
>SomeClass as (new() => T) : new () => T
>SomeClass : typeof SomeClass
>T : T
}
}

View File

@ -0,0 +1,20 @@
// @declaration: true
namespace Test
{
export interface IFace
{
}
export class SomeClass implements IFace
{
}
export class Derived extends getClass<IFace>()
{
}
export function getClass<T>() : new() => T
{
return SomeClass as (new() => T);
}
}