Skip to content

Commit

Permalink
feat: export modifiers (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcikado authored May 20, 2024
1 parent a7e18b7 commit 34e07fc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
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

0 comments on commit 34e07fc

Please sign in to comment.