本文整理匯總了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"));
});