add scalar api reference

This commit is contained in:
2024-04-12 21:20:28 +02:00
parent 78d77ffd05
commit 616626b4ce
23 changed files with 2428 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
type Constructor<T = object> = new (...args: any[]) => T
type Wrapper<T = object> = { new (): T & any; prototype: T }
type DecoratorOptions = { name: string }
type ApiSchemaDecorator = <T extends Constructor>(
options: DecoratorOptions
) => (constructor: T) => Wrapper<T>
export const ApiSchema: ApiSchemaDecorator = ({ name }) => {
return constructor => {
const wrapper = class extends constructor {}
Object.defineProperty(wrapper, 'name', {
value: name,
writable: false,
})
return wrapper
}
}