Add test for decorator referencing alias named Event

This commit is contained in:
Sheetal Nandi 2017-01-19 13:51:34 -08:00
parent 2c48e26f19
commit d22b963b0b
4 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,38 @@
//// [tests/cases/compiler/metadataOfEventAlias.ts] ////
//// [event.ts]
export interface Event { title: string };
//// [test.ts]
import { Event } from './event';
function Input(target: any, key: string): void { }
export class SomeClass {
@Input event: Event;
}
//// [event.js]
"use strict";
;
//// [test.js]
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
function Input(target, key) { }
var SomeClass = (function () {
function SomeClass() {
}
return SomeClass;
}());
__decorate([
Input,
__metadata("design:type", event_1.Event)
], SomeClass.prototype, "event", void 0);
exports.SomeClass = SomeClass;

View file

@ -0,0 +1,23 @@
=== tests/cases/compiler/event.ts ===
export interface Event { title: string };
>Event : Symbol(Event, Decl(event.ts, 0, 0))
>title : Symbol(Event.title, Decl(event.ts, 1, 24))
=== tests/cases/compiler/test.ts ===
import { Event } from './event';
>Event : Symbol(Event, Decl(test.ts, 0, 8))
function Input(target: any, key: string): void { }
>Input : Symbol(Input, Decl(test.ts, 0, 32))
>target : Symbol(target, Decl(test.ts, 1, 15))
>key : Symbol(key, Decl(test.ts, 1, 27))
export class SomeClass {
>SomeClass : Symbol(SomeClass, Decl(test.ts, 1, 50))
@Input event: Event;
>Input : Symbol(Input, Decl(test.ts, 0, 32))
>event : Symbol(SomeClass.event, Decl(test.ts, 2, 24))
>Event : Symbol(Event, Decl(test.ts, 0, 8))
}

View file

@ -0,0 +1,23 @@
=== tests/cases/compiler/event.ts ===
export interface Event { title: string };
>Event : Event
>title : string
=== tests/cases/compiler/test.ts ===
import { Event } from './event';
>Event : any
function Input(target: any, key: string): void { }
>Input : (target: any, key: string) => void
>target : any
>key : string
export class SomeClass {
>SomeClass : SomeClass
@Input event: Event;
>Input : (target: any, key: string) => void
>event : Event
>Event : Event
}

View file

@ -0,0 +1,14 @@
// @experimentalDecorators: true
// @emitDecoratorMetadata: true
// @target: es5
// @includeBuiltFile: lib.d.ts
// @filename: event.ts
export interface Event { title: string };
// @filename: test.ts
import { Event } from './event';
function Input(target: any, key: string): void { }
export class SomeClass {
@Input event: Event;
}