14 lines
600 B
TypeScript
14 lines
600 B
TypeScript
export default {
|
|
string: (args = {}) => ({ type: "string" as const, ...args }),
|
|
object: <P extends {}, A extends {}>(properties: P = {}, args: A = {}) => ({
|
|
type: "object" as const,
|
|
properties,
|
|
...args,
|
|
}),
|
|
boolean: (args = {}) => ({ type: "boolean" as const, ...args }),
|
|
number: (args = {}) => ({ type: "number" as const, ...args }),
|
|
integer: (args = {}) => ({ type: "integer" as const, ...args }),
|
|
type: <S extends string>(type: S, args = {}) => ({ type, ...args }),
|
|
ref: <S extends string>(ref: S, args = {}) => ({ $ref: ref, ...args }),
|
|
};
|