|
| 1 | +//// [tests/cases/compiler/decoratorReferenceOnOtherProperty.ts] //// |
| 2 | + |
| 3 | +//// [yoha.ts] |
| 4 | +// https://github.com/Microsoft/TypeScript/issues/19799 |
| 5 | +export class Yoha {} |
| 6 | + |
| 7 | +//// [index.ts] |
| 8 | +import {Yoha} from './yoha'; |
| 9 | + |
| 10 | +function foo(...args: any[]) {} |
| 11 | + |
| 12 | +class Bar { |
| 13 | + yoha(@foo yoha, bar: Yoha) {} |
| 14 | + // ^^^^ |
| 15 | +} |
| 16 | + |
| 17 | +//// [index2.ts] |
| 18 | +import {Yoha} from './yoha'; |
| 19 | + |
| 20 | +function foo(...args: any[]) {} |
| 21 | + |
| 22 | +class Bar { |
| 23 | + yoha(@foo yoha, ...bar: Yoha[]) {} |
| 24 | + // ^^^^ |
| 25 | +} |
| 26 | + |
| 27 | +//// [yoha.js] |
| 28 | +"use strict"; |
| 29 | +exports.__esModule = true; |
| 30 | +// https://github.com/Microsoft/TypeScript/issues/19799 |
| 31 | +var Yoha = /** @class */ (function () { |
| 32 | + function Yoha() { |
| 33 | + } |
| 34 | + return Yoha; |
| 35 | +}()); |
| 36 | +exports.Yoha = Yoha; |
| 37 | +//// [index.js] |
| 38 | +"use strict"; |
| 39 | +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
| 40 | + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
| 41 | + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
| 42 | + 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; |
| 43 | + return c > 3 && r && Object.defineProperty(target, key, r), r; |
| 44 | +}; |
| 45 | +var __metadata = (this && this.__metadata) || function (k, v) { |
| 46 | + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
| 47 | +}; |
| 48 | +var __param = (this && this.__param) || function (paramIndex, decorator) { |
| 49 | + return function (target, key) { decorator(target, key, paramIndex); } |
| 50 | +}; |
| 51 | +exports.__esModule = true; |
| 52 | +var yoha_1 = require("./yoha"); |
| 53 | +function foo() { |
| 54 | + var args = []; |
| 55 | + for (var _i = 0; _i < arguments.length; _i++) { |
| 56 | + args[_i] = arguments[_i]; |
| 57 | + } |
| 58 | +} |
| 59 | +var Bar = /** @class */ (function () { |
| 60 | + function Bar() { |
| 61 | + } |
| 62 | + Bar.prototype.yoha = function (yoha, bar) { }; |
| 63 | + __decorate([ |
| 64 | + __param(0, foo), |
| 65 | + __metadata("design:type", Function), |
| 66 | + __metadata("design:paramtypes", [Object, yoha_1.Yoha]), |
| 67 | + __metadata("design:returntype", void 0) |
| 68 | + ], Bar.prototype, "yoha"); |
| 69 | + return Bar; |
| 70 | +}()); |
| 71 | +//// [index2.js] |
| 72 | +"use strict"; |
| 73 | +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { |
| 74 | + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
| 75 | + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); |
| 76 | + 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; |
| 77 | + return c > 3 && r && Object.defineProperty(target, key, r), r; |
| 78 | +}; |
| 79 | +var __metadata = (this && this.__metadata) || function (k, v) { |
| 80 | + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); |
| 81 | +}; |
| 82 | +var __param = (this && this.__param) || function (paramIndex, decorator) { |
| 83 | + return function (target, key) { decorator(target, key, paramIndex); } |
| 84 | +}; |
| 85 | +exports.__esModule = true; |
| 86 | +var yoha_1 = require("./yoha"); |
| 87 | +function foo() { |
| 88 | + var args = []; |
| 89 | + for (var _i = 0; _i < arguments.length; _i++) { |
| 90 | + args[_i] = arguments[_i]; |
| 91 | + } |
| 92 | +} |
| 93 | +var Bar = /** @class */ (function () { |
| 94 | + function Bar() { |
| 95 | + } |
| 96 | + Bar.prototype.yoha = function (yoha) { |
| 97 | + var bar = []; |
| 98 | + for (var _i = 1; _i < arguments.length; _i++) { |
| 99 | + bar[_i - 1] = arguments[_i]; |
| 100 | + } |
| 101 | + }; |
| 102 | + __decorate([ |
| 103 | + __param(0, foo), |
| 104 | + __metadata("design:type", Function), |
| 105 | + __metadata("design:paramtypes", [Object, yoha_1.Yoha]), |
| 106 | + __metadata("design:returntype", void 0) |
| 107 | + ], Bar.prototype, "yoha"); |
| 108 | + return Bar; |
| 109 | +}()); |
0 commit comments