This commit is contained in:
Lukian 2023-06-20 15:28:07 +02:00
parent 68f4b60012
commit 41ae7ff4bd
1010 changed files with 38622 additions and 17071 deletions

View file

@ -266,25 +266,18 @@ const decorateClass = (decorator) => ((clazz) => {
return decorator(clazz);
});
const decorateMember = (decorator) => ((object, key, ...otherArgs) => {
var _a, _b, _c;
const decoratorTargetType = typeof object === 'function' ? 'static' : 'instance';
const decoratorType = typeof object[key] === 'function' ? 'method' : 'property';
const clazz = decoratorTargetType === 'static' ? object : object.constructor;
const decoratorsForClass = getDecoratorsForClass(clazz);
let decoratorsForTargetType = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType];
if (!decoratorsForTargetType) {
decoratorsForTargetType = {};
decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
}
let decoratorsForType = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType];
if (!decoratorsForType) {
decoratorsForType = {};
decoratorsForTargetType[decoratorType] = decoratorsForType;
}
let decoratorsForKey = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key];
if (!decoratorsForKey) {
decoratorsForKey = [];
decoratorsForType[key] = decoratorsForKey;
}
const decoratorsForTargetType = (_a = decoratorsForClass === null || decoratorsForClass === void 0 ? void 0 : decoratorsForClass[decoratorTargetType]) !== null && _a !== void 0 ? _a : {};
decoratorsForClass[decoratorTargetType] = decoratorsForTargetType;
let decoratorsForType = (_b = decoratorsForTargetType === null || decoratorsForTargetType === void 0 ? void 0 : decoratorsForTargetType[decoratorType]) !== null && _b !== void 0 ? _b : {};
decoratorsForTargetType[decoratorType] = decoratorsForType;
let decoratorsForKey = (_c = decoratorsForType === null || decoratorsForType === void 0 ? void 0 : decoratorsForType[key]) !== null && _c !== void 0 ? _c : [];
decoratorsForType[key] = decoratorsForKey;
// @ts-ignore: array is type `A[] | B[]` and item is type `A | B`, so technically a type error, but it's fine
decoratorsForKey.push(decorator);
// @ts-ignore
return decorator(object, key, ...otherArgs);