Skip to content

Commit c6ff093

Browse files
Merge pull request #1359 from open-circle/feat-export-raw-check-and-raw-transform-types
Export raw check and transform types for improved DX
2 parents 4f5737e + 9f0f060 commit c6ff093

26 files changed

Lines changed: 128 additions & 133 deletions

File tree

library/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to the library will be documented in this file.
55
## vX.X.X (Month DD, YYYY)
66

77
- Add `toBigint`, `toBoolean`, `toDate`, `toNumber` and `toString` transformation actions (pull request #1212)
8+
- Export `RawCheckAddIssue`, `RawCheckContext`, `RawCheckIssueInfo`, `RawTransformAddIssue`, `RawTransformContext` and `RawTransformIssueInfo` types for better developer experience with `rawCheck` and `rawTransform` actions (pull request #1358)
89
- Change build step to tsdown
910

1011
## v1.1.0 (May 06, 2025)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './rawCheck.ts';
22
export * from './rawCheckAsync.ts';
3-
export type { RawCheckIssue } from './types.ts';
3+
export * from './types.ts';

library/src/actions/rawCheck/rawCheck.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BaseValidation } from '../../types/index.ts';
22
import { _addIssue } from '../../utils/index.ts';
3-
import type { Context, RawCheckIssue } from './types.ts';
3+
import type { RawCheckContext, RawCheckIssue } from './types.ts';
44

55
/**
66
* Raw check action interface.
@@ -30,7 +30,7 @@ export interface RawCheckAction<TInput>
3030
*/
3131
// @__NO_SIDE_EFFECTS__
3232
export function rawCheck<TInput>(
33-
action: (context: Context<TInput>) => void
33+
action: (context: RawCheckContext<TInput>) => void
3434
): RawCheckAction<TInput> {
3535
return {
3636
kind: 'validation',

library/src/actions/rawCheck/rawCheckAsync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { BaseValidationAsync, MaybePromise } from '../../types/index.ts';
22
import { _addIssue } from '../../utils/index.ts';
3-
import type { Context, RawCheckIssue } from './types.ts';
3+
import type { RawCheckContext, RawCheckIssue } from './types.ts';
44

55
/**
66
* Raw check action async interface.
@@ -30,7 +30,7 @@ export interface RawCheckActionAsync<TInput>
3030
*/
3131
// @__NO_SIDE_EFFECTS__
3232
export function rawCheckAsync<TInput>(
33-
action: (context: Context<TInput>) => MaybePromise<void>
33+
action: (context: RawCheckContext<TInput>) => MaybePromise<void>
3434
): RawCheckActionAsync<TInput> {
3535
return {
3636
kind: 'validation',

library/src/actions/rawCheck/types.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export interface RawCheckIssue<TInput> extends BaseIssue<TInput> {
2121
}
2222

2323
/**
24-
* Issue info interface.
24+
* Raw check issue info interface.
2525
*/
26-
interface IssueInfo<TInput> {
26+
export interface RawCheckIssueInfo<TInput> {
2727
label?: string | undefined;
2828
input?: unknown | undefined;
2929
expected?: string | undefined;
@@ -33,15 +33,17 @@ interface IssueInfo<TInput> {
3333
}
3434

3535
/**
36-
* Add issue type.
36+
* Raw check add issue type.
3737
*/
38-
type AddIssue<TInput> = (info?: IssueInfo<TInput>) => void;
38+
export type RawCheckAddIssue<TInput> = (
39+
info?: RawCheckIssueInfo<TInput>
40+
) => void;
3941

4042
/**
41-
* Context interface.
43+
* Raw check context interface.
4244
*/
43-
export interface Context<TInput> {
45+
export interface RawCheckContext<TInput> {
4446
readonly dataset: OutputDataset<TInput, BaseIssue<unknown>>;
4547
readonly config: Config<RawCheckIssue<TInput>>;
46-
readonly addIssue: AddIssue<TInput>;
48+
readonly addIssue: RawCheckAddIssue<TInput>;
4749
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './rawTransform.ts';
22
export * from './rawTransformAsync.ts';
3-
export type { RawTransformIssue } from './types.ts';
3+
export * from './types.ts';

library/src/actions/rawTransform/rawTransform.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
OutputDataset,
55
} from '../../types/index.ts';
66
import { _addIssue } from '../../utils/index.ts';
7-
import type { Context, RawTransformIssue } from './types.ts';
7+
import type { RawTransformContext, RawTransformIssue } from './types.ts';
88

99
/**
1010
* Raw transform action interface.
@@ -30,7 +30,7 @@ export interface RawTransformAction<TInput, TOutput>
3030
*/
3131
// @__NO_SIDE_EFFECTS__
3232
export function rawTransform<TInput, TOutput>(
33-
action: (context: Context<TInput>) => TOutput
33+
action: (context: RawTransformContext<TInput>) => TOutput
3434
): RawTransformAction<TInput, TOutput> {
3535
return {
3636
kind: 'transformation',

library/src/actions/rawTransform/rawTransformAsync.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
OutputDataset,
66
} from '../../types/index.ts';
77
import { _addIssue } from '../../utils/index.ts';
8-
import type { Context, RawTransformIssue } from './types.ts';
8+
import type { RawTransformContext, RawTransformIssue } from './types.ts';
99

1010
/**
1111
* Raw transform action async interface.
@@ -31,7 +31,7 @@ export interface RawTransformActionAsync<TInput, TOutput>
3131
*/
3232
// @__NO_SIDE_EFFECTS__
3333
export function rawTransformAsync<TInput, TOutput>(
34-
action: (context: Context<TInput>) => MaybePromise<TOutput>
34+
action: (context: RawTransformContext<TInput>) => MaybePromise<TOutput>
3535
): RawTransformActionAsync<TInput, TOutput> {
3636
return {
3737
kind: 'transformation',

library/src/actions/rawTransform/types.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export interface RawTransformIssue<TInput> extends BaseIssue<TInput> {
2121
}
2222

2323
/**
24-
* Issue info interface.
24+
* Raw transform issue info interface.
2525
*/
26-
interface IssueInfo<TInput> {
26+
export interface RawTransformIssueInfo<TInput> {
2727
label?: string | undefined;
2828
input?: unknown | undefined;
2929
expected?: string | undefined;
@@ -33,16 +33,18 @@ interface IssueInfo<TInput> {
3333
}
3434

3535
/**
36-
* Add issue type.
36+
* Raw transform add issue type.
3737
*/
38-
type AddIssue<TInput> = (info?: IssueInfo<TInput>) => void;
38+
export type RawTransformAddIssue<TInput> = (
39+
info?: RawTransformIssueInfo<TInput>
40+
) => void;
3941

4042
/**
41-
* Context interface.
43+
* Raw transform context interface.
4244
*/
43-
export interface Context<TInput> {
45+
export interface RawTransformContext<TInput> {
4446
readonly dataset: SuccessDataset<TInput>;
4547
readonly config: Config<RawTransformIssue<TInput>>;
46-
readonly addIssue: AddIssue<TInput>;
48+
readonly addIssue: RawTransformAddIssue<TInput>;
4749
readonly NEVER: never;
4850
}

website/src/routes/api/(actions)/rawCheck/AddIssue/index.mdx

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)