本文整理汇总了TypeScript中@tsed/core.descriptorOf函数的典型用法代码示例。如果您正苦于以下问题:TypeScript descriptorOf函数的具体用法?TypeScript descriptorOf怎么用?TypeScript descriptorOf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了descriptorOf函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: before
before(() => {
ReturnsArray({
description: "Success",
type: Test
})(Test, "test4", descriptorOf(Test, "test4"));
this.store = Store.fromMethod(Test, "test4");
});
示例2: before
before(() => {
try {
Inject()(Test, "test", descriptorOf(Test, "test"));
} catch (er) {
this.error = er;
}
});
示例3: AutoMapKey
/**
* Internal use only.
* @returns {Function}
* @decorator
* @private
* @param target
* @param propertyKey
*/
function AutoMapKey(target: any, propertyKey: string): any {
AUTO_MAP_KEYS.push(propertyKey);
const descriptor = descriptorOf(target, propertyKey) || {configurable: true, writable: true};
descriptor.enumerable = true;
return descriptor;
}
示例4: before
before(() => {
this.store = new Store([Test.prototype, "test", descriptorOf(Test.prototype, "test")]);
this.store.delete("multipartAdded");
this.store.delete(MultipartFileMiddleware);
this.storeFromMethodStub.returns(this.store);
this.getParamTypesStub.returns([Array]);
MultipartFile("file1", 8)(Test.prototype, "test", 0);
});
示例5: it
it("should set the responses", () => {
// WHEN
Responses(400, {
description: "Bad Request"
})(prototypeOf(Test), "test", descriptorOf(Test, "test"));
// THEN
const store = Store.fromMethod(Test, "test");
store.get("responses").should.deep.eq({
"400": {
description: "Bad Request"
}
});
});
示例6: it
it("should set the operation", () => {
// WHEN
Operation({
security: [
{"auth": ["scope"]}
]
})(prototypeOf(Test), "test", descriptorOf(Test, "test"));
// THEN
const store = Store.fromMethod(Test, "test");
store.get("operation").should.deep.eq({
security: [
{"auth": ["scope"]}
]
});
});
示例7: store
/**
* Store a data on store manager.
* @param targetClass
* @param methodClassName
* @returns {any}
*/
static store(targetClass: any, methodClassName: string): Store {
return Store.from(targetClass, methodClassName, descriptorOf(targetClass, methodClassName));
}
示例8: before
before(() => {
Security("securityDefinitionName", "scope1", "scope2")(prototypeOf(Test), "test", descriptorOf(Test, "test"));
this.store = Store.from(Test, "test", descriptorOf(Test, "test"));
});