Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions tests/baselines/reference/decoratorOnClassConstructor3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//// [tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor3.ts] ////

//// [0.ts]

export class base { }
export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }

//// [2.ts]
import {base} from "./0"
import {foo} from "./0"

/* Comment on the Class Declaration */
export class C extends base{
constructor(@foo prop: any) {
super();
}
}

//// [0.js]
"use strict";
var base = (function () {
function base() {
}
return base;
}());
exports.base = base;
function foo(target, propertyKey, parameterIndex) { }
exports.foo = foo;
//// [2.js]
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
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 __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var _0_1 = require("./0");
var _0_2 = require("./0");
/* Comment on the Class Declaration */
var C = (function (_super) {
__extends(C, _super);
function C(prop) {
_super.call(this);
}
return C;
}(_0_1.base));
C = __decorate([
__param(0, _0_2.foo)
], C);
exports.C = C;
32 changes: 32 additions & 0 deletions tests/baselines/reference/decoratorOnClassConstructor3.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
=== tests/cases/conformance/decorators/class/constructor/0.ts ===

export class base { }
>base : Symbol(base, Decl(0.ts, 0, 0))

export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }
>foo : Symbol(foo, Decl(0.ts, 1, 21))
>target : Symbol(target, Decl(0.ts, 2, 20))
>Object : Symbol(Object, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>propertyKey : Symbol(propertyKey, Decl(0.ts, 2, 35))
>parameterIndex : Symbol(parameterIndex, Decl(0.ts, 2, 65))

=== tests/cases/conformance/decorators/class/constructor/2.ts ===
import {base} from "./0"
>base : Symbol(base, Decl(2.ts, 0, 8))

import {foo} from "./0"
>foo : Symbol(foo, Decl(2.ts, 1, 8))

/* Comment on the Class Declaration */
export class C extends base{
>C : Symbol(C, Decl(2.ts, 1, 23))
>base : Symbol(base, Decl(2.ts, 0, 8))

constructor(@foo prop: any) {
>foo : Symbol(foo, Decl(2.ts, 1, 8))
>prop : Symbol(prop, Decl(2.ts, 5, 16))

super();
>super : Symbol(base, Decl(0.ts, 0, 0))
}
}
33 changes: 33 additions & 0 deletions tests/baselines/reference/decoratorOnClassConstructor3.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
=== tests/cases/conformance/decorators/class/constructor/0.ts ===

export class base { }
>base : base

export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }
>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>target : Object
>Object : Object
>propertyKey : string | symbol
>parameterIndex : number

=== tests/cases/conformance/decorators/class/constructor/2.ts ===
import {base} from "./0"
>base : typeof base

import {foo} from "./0"
>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void

/* Comment on the Class Declaration */
export class C extends base{
>C : C
>base : base

constructor(@foo prop: any) {
>foo : (target: Object, propertyKey: string | symbol, parameterIndex: number) => void
>prop : any

super();
>super() : void
>super : typeof base
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// @target: es5
// @module: commonjs
// @experimentaldecorators: true

// @Filename: 0.ts
export class base { }
export function foo(target: Object, propertyKey: string | symbol, parameterIndex: number) { }

// @Filename: 2.ts
import {base} from "./0"
import {foo} from "./0"

/* Comment on the Class Declaration */
export class C extends base{
constructor(@foo prop: any) {
super();
}
}