Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: export modifiers #48

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
".": "./build/index.js",
"./defaults": "./build/src/defaults.js",
"./factories": "./build/factories/main.js",
"./types": "./build/src/types.js"
"./types": "./build/src/types.js",
"./schema/base/*": "./build/src/schema/base/*.js"
},
"scripts": {
"pretest": "npm run lint",
Expand Down
10 changes: 7 additions & 3 deletions src/schema/base/literal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ abstract class BaseModifiersType<Input, Output, CamelCaseOutput>
/**
* Modifies the schema type to allow null values
*/
class NullableModifier<Schema extends BaseModifiersType<any, any, any>> extends BaseModifiersType<
export class NullableModifier<
Schema extends BaseModifiersType<any, any, any>,
> extends BaseModifiersType<
Schema[typeof ITYPE] | null,
Schema[typeof OTYPE] | null,
Schema[typeof COTYPE] | null
Expand Down Expand Up @@ -124,7 +126,9 @@ class NullableModifier<Schema extends BaseModifiersType<any, any, any>> extends
/**
* Modifies the schema type to allow undefined values
*/
class OptionalModifier<Schema extends BaseModifiersType<any, any, any>> extends BaseModifiersType<
export class OptionalModifier<
Schema extends BaseModifiersType<any, any, any>,
> extends BaseModifiersType<
Schema[typeof ITYPE] | undefined | null,
Schema[typeof OTYPE] | undefined,
Schema[typeof COTYPE] | undefined
Expand Down Expand Up @@ -334,7 +338,7 @@ class OptionalModifier<Schema extends BaseModifiersType<any, any, any>> extends
/**
* Modifies the schema type to allow custom transformed values
*/
class TransformModifier<
export class TransformModifier<
Schema extends BaseModifiersType<any, any, any>,
Output,
> extends BaseModifiersType<Schema[typeof ITYPE], Output, Output> {
Expand Down
8 changes: 6 additions & 2 deletions src/schema/base/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export abstract class BaseModifiersType<Input, Output, CamelCaseOutput>
/**
* Modifies the schema type to allow null values
*/
class NullableModifier<Schema extends BaseModifiersType<any, any, any>> extends BaseModifiersType<
export class NullableModifier<
Schema extends BaseModifiersType<any, any, any>,
> extends BaseModifiersType<
Schema[typeof ITYPE] | null,
Schema[typeof OTYPE] | null,
Schema[typeof COTYPE] | null
Expand Down Expand Up @@ -108,7 +110,9 @@ class NullableModifier<Schema extends BaseModifiersType<any, any, any>> extends
/**
* Modifies the schema type to allow undefined values
*/
class OptionalModifier<Schema extends BaseModifiersType<any, any, any>> extends BaseModifiersType<
export class OptionalModifier<
Schema extends BaseModifiersType<any, any, any>,
> extends BaseModifiersType<
Schema[typeof ITYPE] | undefined | null,
Schema[typeof OTYPE] | undefined,
Schema[typeof COTYPE] | undefined
Expand Down
Loading