mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Updated baselines
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,9): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts(3,17): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnArrowFunction.ts (3 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
var F = @dec () => {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~~~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [decoratorOnArrowFunction.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
var F = @dec () => {
|
||||
}
|
||||
|
||||
//// [decoratorOnArrowFunction.js]
|
||||
var F = ;
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClass1.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
}
|
||||
|
||||
//// [decoratorOnClass1.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([dec], C);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/decorators/class/decoratorOnClass1.ts ===
|
||||
declare function dec<T>(target: T): T;
|
||||
>dec : <T>(target: T) => T
|
||||
>T : T
|
||||
>target : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
@dec
|
||||
>dec : unknown
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [decoratorOnClass2.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
export class C {
|
||||
}
|
||||
|
||||
//// [decoratorOnClass2.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([dec], C);
|
||||
return C;
|
||||
})();
|
||||
exports.C = C;
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/decorators/class/decoratorOnClass2.ts ===
|
||||
declare function dec<T>(target: T): T;
|
||||
>dec : <T>(target: T) => T
|
||||
>T : T
|
||||
>target : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
@dec
|
||||
>dec : unknown
|
||||
|
||||
export class C {
|
||||
>C : C
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/conformance/decorators/class/decoratorOnClass3.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/decoratorOnClass3.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
export
|
||||
~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@dec
|
||||
class C {
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//// [decoratorOnClass3.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
export
|
||||
@dec
|
||||
class C {
|
||||
}
|
||||
|
||||
//// [decoratorOnClass3.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([dec], C);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClass4.ts]
|
||||
declare function dec(): <T>(target: T) => T;
|
||||
|
||||
@dec()
|
||||
class C {
|
||||
}
|
||||
|
||||
//// [decoratorOnClass4.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([dec()], C);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/decorators/class/decoratorOnClass4.ts ===
|
||||
declare function dec(): <T>(target: T) => T;
|
||||
>dec : () => <T>(target: T) => T
|
||||
>T : T
|
||||
>target : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
@dec()
|
||||
>dec() : <T>(target: T) => T
|
||||
>dec : () => <T>(target: T) => T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClass5.ts]
|
||||
declare function dec(): <T>(target: T) => T;
|
||||
|
||||
@dec()
|
||||
class C {
|
||||
}
|
||||
|
||||
//// [decoratorOnClass5.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([dec()], C);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/decorators/class/decoratorOnClass5.ts ===
|
||||
declare function dec(): <T>(target: T) => T;
|
||||
>dec : () => <T>(target: T) => T
|
||||
>T : T
|
||||
>target : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
@dec()
|
||||
>dec() : <T>(target: T) => T
|
||||
>dec : () => <T>(target: T) => T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/class/decoratorOnClass8.ts(3,1): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'ClassAnnotation'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/decoratorOnClass8.ts (1 errors) ====
|
||||
declare function dec(): (target: Function, paramIndex: number) => void;
|
||||
|
||||
@dec()
|
||||
~~~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'ClassAnnotation'.
|
||||
class C {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClass8.ts]
|
||||
declare function dec(): (target: Function, paramIndex: number) => void;
|
||||
|
||||
@dec()
|
||||
class C {
|
||||
}
|
||||
|
||||
//// [decoratorOnClass8.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([dec()], C);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [decoratorOnClassAccessor1.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec get accessor() { return 1; }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor1.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "accessor", {
|
||||
get: function () {
|
||||
return 1;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
__decorate([dec], C.prototype, "accessor");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor1.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec get accessor() { return 1; }
|
||||
>dec : unknown
|
||||
>accessor : number
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//// [decoratorOnClassAccessor2.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec public get accessor() { return 1; }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor2.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "accessor", {
|
||||
get: function () {
|
||||
return 1;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
__decorate([dec], C.prototype, "accessor");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor2.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec public get accessor() { return 1; }
|
||||
>dec : unknown
|
||||
>accessor : number
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,17): error TS2304: Cannot find name 'get'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,21): error TS2304: Cannot find name 'accessor'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(4,32): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor3.ts (9 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec get accessor() { return 1; }
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'get'.
|
||||
~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'accessor'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -0,0 +1,19 @@
|
||||
//// [decoratorOnClassAccessor3.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec get accessor() { return 1; }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor3.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
public;
|
||||
get;
|
||||
accessor();
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [decoratorOnClassAccessor4.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec set accessor(value: number) { }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor4.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "accessor", {
|
||||
set: function (value) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
__decorate([dec], C.prototype, "accessor");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor4.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec set accessor(value: number) { }
|
||||
>dec : unknown
|
||||
>accessor : number
|
||||
>value : number
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//// [decoratorOnClassAccessor5.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec public set accessor(value: number) { }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor5.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
Object.defineProperty(C.prototype, "accessor", {
|
||||
set: function (value) {
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
__decorate([dec], C.prototype, "accessor");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor5.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec public set accessor(value: number) { }
|
||||
>dec : unknown
|
||||
>accessor : number
|
||||
>value : number
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,17): error TS2304: Cannot find name 'set'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,21): error TS2304: Cannot find name 'accessor'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,30): error TS2304: Cannot find name 'value'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,35): error TS1005: ',' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,37): error TS2304: Cannot find name 'number'.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(4,45): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/accessor/decoratorOnClassAccessor6.ts (12 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec set accessor(value: number) { }
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'set'.
|
||||
~~~~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'accessor'.
|
||||
~~~~~
|
||||
!!! error TS2304: Cannot find name 'value'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'number'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [decoratorOnClassAccessor6.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec set accessor(value: number) { }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassAccessor6.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
public;
|
||||
set;
|
||||
accessor(value, number);
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor1.ts(4,5): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/constructor/decoratorOnClassConstructor1.ts (1 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec constructor() {}
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [decoratorOnClassConstructor1.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec constructor() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassConstructor1.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassConstructorParameter1.ts]
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
constructor(@dec p: number) {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassConstructorParameter1.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C(p) {
|
||||
}
|
||||
__decorate([dec], C, 0);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter1.ts ===
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
>dec : (target: Function, parameterIndex: number) => void
|
||||
>target : Function
|
||||
>Function : Function
|
||||
>parameterIndex : number
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
constructor(@dec p: number) {}
|
||||
>dec : unknown
|
||||
>p : number
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts(4,24): error TS1005: ',' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/constructor/parameter/decoratorOnClassConstructorParameter4.ts (1 errors) ====
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
constructor(public @dec p: number) {}
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassConstructorParameter4.ts]
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
constructor(public @dec p: number) {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassConstructorParameter4.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C(public, p) {
|
||||
}
|
||||
__decorate([dec], C, 1);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [decoratorOnClassMethod1.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec method() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod1.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function () {
|
||||
};
|
||||
__decorate([dec], C.prototype, "method");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod1.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec method() {}
|
||||
>dec : unknown
|
||||
>method : () => void
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
Type 'number' is not assignable to type 'string | symbol'.
|
||||
Type 'number' is not assignable to type 'symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod10.ts (1 errors) ====
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec method() {}
|
||||
~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [decoratorOnClassMethod10.ts]
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec method() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod10.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function () {
|
||||
};
|
||||
__decorate([dec], C.prototype, "method");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [decoratorOnClassMethod2.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec public method() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod2.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function () {
|
||||
};
|
||||
__decorate([dec], C.prototype, "method");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod2.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec public method() {}
|
||||
>dec : unknown
|
||||
>method : () => void
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,17): error TS2304: Cannot find name 'method'.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(4,26): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod3.ts (7 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec method() {}
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'method'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [decoratorOnClassMethod3.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec method() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod3.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
public;
|
||||
method();
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [decoratorOnClassMethod4.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec ["method"]() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod4.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function() {
|
||||
class C {
|
||||
[_a = "method"]() {
|
||||
}
|
||||
}
|
||||
__decorate([dec], C.prototype, _a);
|
||||
return C;
|
||||
var _a;
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod4.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec ["method"]() {}
|
||||
>dec : unknown
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [decoratorOnClassMethod5.ts]
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec() ["method"]() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod5.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function() {
|
||||
class C {
|
||||
[_a = "method"]() {
|
||||
}
|
||||
}
|
||||
__decorate([dec()], C.prototype, _a);
|
||||
return C;
|
||||
var _a;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod5.ts ===
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec() ["method"]() {}
|
||||
>dec() : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [decoratorOnClassMethod6.ts]
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec ["method"]() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod6.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function() {
|
||||
class C {
|
||||
[_a = "method"]() {
|
||||
}
|
||||
}
|
||||
__decorate([dec], C.prototype, _a);
|
||||
return C;
|
||||
var _a;
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod6.ts ===
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec ["method"]() {}
|
||||
>dec : unknown
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
//// [decoratorOnClassMethod7.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec public ["method"]() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod7.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function() {
|
||||
class C {
|
||||
[_a = "method"]() {
|
||||
}
|
||||
}
|
||||
__decorate([dec], C.prototype, _a);
|
||||
return C;
|
||||
var _a;
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod7.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec public ["method"]() {}
|
||||
>dec : unknown
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [decoratorOnClassMethod8.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
class C {
|
||||
@dec method() {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod8.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function () {
|
||||
};
|
||||
__decorate([dec], C.prototype, "method");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod8.ts ===
|
||||
declare function dec<T>(target: T): T;
|
||||
>dec : <T>(target: T) => T
|
||||
>T : T
|
||||
>target : T
|
||||
>T : T
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec method() {}
|
||||
>dec : unknown
|
||||
>method : () => void
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//// [decoratorOnClassMethodParameter1.ts]
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
method(@dec p: number) {}
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethodParameter1.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.method = function (p) {
|
||||
};
|
||||
__decorate([dec], C.prototype.method, 0);
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/decorators/class/method/parameter/decoratorOnClassMethodParameter1.ts ===
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
>dec : (target: Function, parameterIndex: number) => void
|
||||
>target : Function
|
||||
>Function : Function
|
||||
>parameterIndex : number
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
method(@dec p: number) {}
|
||||
>method : (p: number) => void
|
||||
>dec : unknown
|
||||
>p : number
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty1.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty1.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty1.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec prop;
|
||||
>dec : unknown
|
||||
>prop : any
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty10.ts]
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec() prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty10.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec()], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty10.ts ===
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec() prop;
|
||||
>dec() : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>prop : any
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty11.ts]
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty11.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty11.ts ===
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec prop;
|
||||
>dec : unknown
|
||||
>prop : any
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty12.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<number>;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty12.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty12.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<number>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<number>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec prop;
|
||||
>dec : unknown
|
||||
>prop : any
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts(4,5): error TS1205: Decorators may not change the type of a member.
|
||||
Type 'TypedPropertyDescriptor<number>' is not assignable to type 'void | TypedPropertyDescriptor<string>'.
|
||||
Type 'TypedPropertyDescriptor<number>' is not assignable to type 'TypedPropertyDescriptor<string>'.
|
||||
Type 'number' is not assignable to type 'string'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty13.ts (1 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<number>;
|
||||
|
||||
class C {
|
||||
@dec prop: string;
|
||||
~~~~
|
||||
!!! error TS1205: Decorators may not change the type of a member.
|
||||
!!! error TS1205: Type 'TypedPropertyDescriptor<number>' is not assignable to type 'void | TypedPropertyDescriptor<string>'.
|
||||
!!! error TS1205: Type 'TypedPropertyDescriptor<number>' is not assignable to type 'TypedPropertyDescriptor<string>'.
|
||||
!!! error TS1205: Type 'number' is not assignable to type 'string'.
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty13.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<number>;
|
||||
|
||||
class C {
|
||||
@dec prop: string;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty13.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty2.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec public prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty2.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty2.ts ===
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
>dec : <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec public prop;
|
||||
>dec : unknown
|
||||
>prop : any
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,5): error TS2304: Cannot find name 'public'.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1005: ';' expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,12): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(4,17): error TS2304: Cannot find name 'prop'.
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty3.ts (6 errors) ====
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec prop;
|
||||
~~~~~~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~~~~~
|
||||
!!! error TS2304: Cannot find name 'public'.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'prop'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [decoratorOnClassProperty3.ts]
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty3.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
public;
|
||||
prop;
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty6.ts]
|
||||
declare function dec(target: Function): void;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty6.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
=== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty6.ts ===
|
||||
declare function dec(target: Function): void;
|
||||
>dec : (target: Function) => void
|
||||
>target : Function
|
||||
>Function : Function
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec prop;
|
||||
>dec : unknown
|
||||
>prop : any
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts(4,5): error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
Type 'number' is not assignable to type 'string | symbol'.
|
||||
Type 'number' is not assignable to type 'symbol'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/class/property/decoratorOnClassProperty7.ts (1 errors) ====
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
~~~~
|
||||
!!! error TS2322: Type '(target: Function, paramIndex: number) => void' is not assignable to type 'PropertyAnnotation'.
|
||||
!!! error TS2322: Types of parameters 'paramIndex' and 'propertyKey' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string | symbol'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'symbol'.
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
//// [decoratorOnClassProperty7.ts]
|
||||
declare function dec(target: Function, paramIndex: number): void;
|
||||
|
||||
class C {
|
||||
@dec prop;
|
||||
}
|
||||
|
||||
//// [decoratorOnClassProperty7.js]
|
||||
var __decorate = this.__decorate || function (decorators, target, key) {
|
||||
var kind = key == null ? 0 : typeof key == "number" ? 1 : 2, result = target;
|
||||
if (kind == 2) result = Object.getOwnPropertyDescriptor(target, typeof key == "symbol" ? key : key = String(key));
|
||||
for (var i = decorators.length - 1; i >= 0; --i) {
|
||||
var decorator = decorators[i];
|
||||
result = (kind == 0 ? decorator(result) : kind == 1 ? decorator(target, key) : decorator(target, key, result)) || result;
|
||||
}
|
||||
if (kind == 2 && result) Object.defineProperty(target, key, result);
|
||||
if (kind == 0) return result;
|
||||
};
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
__decorate([dec], C.prototype, "prop");
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts(4,6): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnEnum.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
enum E {
|
||||
~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [decoratorOnEnum.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
enum E {
|
||||
}
|
||||
|
||||
//// [decoratorOnEnum.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
})(E || (E = {}));
|
||||
@@ -0,0 +1,20 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,5): error TS1132: Enum member expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,5): error TS1146: Declaration expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(4,10): error TS2304: Cannot find name 'A'.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts(5,1): error TS1128: Declaration or statement expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnEnum2.ts (4 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
enum E {
|
||||
@dec A
|
||||
~
|
||||
!!! error TS1132: Enum member expected.
|
||||
~~~~
|
||||
!!! error TS1146: Declaration expected.
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'A'.
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [decoratorOnEnum2.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
enum E {
|
||||
@dec A
|
||||
}
|
||||
|
||||
//// [decoratorOnEnum2.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
})(E || (E = {}));
|
||||
A;
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts(4,10): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionDeclaration.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
function F() {
|
||||
~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [decoratorOnFunctionDeclaration.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
function F() {
|
||||
}
|
||||
|
||||
//// [decoratorOnFunctionDeclaration.js]
|
||||
function F() {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts(3,23): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnFunctionExpression.ts (2 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
var F = @dec function () {
|
||||
~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [decoratorOnFunctionExpression.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
var F = @dec function () {
|
||||
}
|
||||
|
||||
//// [decoratorOnFunctionExpression.js]
|
||||
var F = ;
|
||||
function () {
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts(8,5): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals1.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
module M1 {
|
||||
export var X: number;
|
||||
}
|
||||
|
||||
module M2 {
|
||||
@dec
|
||||
~~~~
|
||||
import X = M1.X;
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [decoratorOnImportEquals1.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
module M1 {
|
||||
export var X: number;
|
||||
}
|
||||
|
||||
module M2 {
|
||||
@dec
|
||||
import X = M1.X;
|
||||
}
|
||||
|
||||
//// [decoratorOnImportEquals1.js]
|
||||
var M1;
|
||||
(function (M1) {
|
||||
M1.X;
|
||||
})(M1 || (M1 = {}));
|
||||
@@ -0,0 +1,14 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts(1,1): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_1.ts (1 errors) ====
|
||||
@dec
|
||||
~~~~
|
||||
import lib = require('./decoratorOnImportEquals2_0');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
declare function dec<T>(target: T): T;
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2_0.ts (0 errors) ====
|
||||
export var X;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [tests/cases/conformance/decorators/invalid/decoratorOnImportEquals2.ts] ////
|
||||
|
||||
//// [decoratorOnImportEquals2_0.ts]
|
||||
export var X;
|
||||
|
||||
//// [decoratorOnImportEquals2_1.ts]
|
||||
@dec
|
||||
import lib = require('./decoratorOnImportEquals2_0');
|
||||
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
//// [decoratorOnImportEquals2_0.js]
|
||||
exports.X;
|
||||
//// [decoratorOnImportEquals2_1.js]
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts(4,11): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnInterface.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
interface I {
|
||||
~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [decoratorOnInterface.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
interface I {
|
||||
}
|
||||
|
||||
//// [decoratorOnInterface.js]
|
||||
@@ -0,0 +1,12 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts(4,8): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnInternalModule.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
module M {
|
||||
~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [decoratorOnInternalModule.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
module M {
|
||||
|
||||
}
|
||||
|
||||
//// [decoratorOnInternalModule.js]
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts(3,1): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnTypeAlias.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
~~~~
|
||||
type T = number;
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [decoratorOnTypeAlias.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
type T = number;
|
||||
|
||||
//// [decoratorOnTypeAlias.js]
|
||||
@@ -0,0 +1,11 @@
|
||||
tests/cases/conformance/decorators/invalid/decoratorOnVar.ts(3,1): error TS1203: Decorators are not valid on this declaration type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/decorators/invalid/decoratorOnVar.ts (1 errors) ====
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
~~~~
|
||||
var x: number;
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1203: Decorators are not valid on this declaration type.
|
||||
@@ -0,0 +1,8 @@
|
||||
//// [decoratorOnVar.ts]
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
var x: number;
|
||||
|
||||
//// [decoratorOnVar.js]
|
||||
var x;
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec get accessor() { return 1; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec public get accessor() { return 1; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec get accessor() { return 1; }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec set accessor(value: number) { }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec public set accessor(value: number) { }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// @target:es5
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
public @dec set accessor(value: number) { }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
declare function dec<T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec constructor() {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
constructor(@dec p: number) {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
declare function dec(target: Function, parameterIndex: number): void;
|
||||
|
||||
class C {
|
||||
constructor(public @dec p: number) {}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
declare function dec<T>(target: T): T;
|
||||
|
||||
@dec
|
||||
class C {
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user