Skip to content

Commit

Permalink
feat(types): add optional type variance
Browse files Browse the repository at this point in the history
  • Loading branch information
TomokiMiyauci committed May 22, 2023
1 parent 1587a62 commit 7d71b8c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { isString } from "./deps.ts";

/** Validator API. */
export interface Validator<In = unknown> extends Display {
export interface Validator<in In = unknown> {
/** Validates the input and yield validation errors if exists. */
validate: (input: In) => Iterable<ValidationError>;
}
Expand All @@ -17,14 +17,10 @@ export interface Display {
toString(): string;
}

export interface Transformer<In = unknown, Out = In> {
export interface Transformer<in In = unknown, out Out = In> {
transform: (input: In) => Out;
}

export interface Struct<In = unknown, In_ extends In = In, Out = unknown>
extends Iterable<Validator<In> | Transformer<In, Out>> {
}

/** Assert API for validated data type. */
export interface Assert<T = unknown> {
[Assert.symbol]: T;
Expand Down

0 comments on commit 7d71b8c

Please sign in to comment.