Skip to content

Commit

Permalink
feat: exports all modules
Browse files Browse the repository at this point in the history
commit 058975d064bd98963dae308770d17cb4eefe26c6
Author: skarab42 <skarab@bluewin.ch>
Date:   Sun Mar 13 05:58:44 2022 +0100

    add infer type alias

commit b9eaf46921c47d447e20dcb4ad72ebbd57f7ed48
Author: skarab42 <skarab@bluewin.ch>
Date:   Sun Mar 13 05:56:56 2022 +0100

    refactor: exports all
  • Loading branch information
skarab42 committed Mar 13, 2022
1 parent 5741096 commit 63895c4
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 71 deletions.
75 changes: 4 additions & 71 deletions src/index.ts
@@ -1,71 +1,4 @@
import { dateType } from "./type/date";
import { instanceofType } from "./type/instanceof";
import { unsignedNumberType } from "./type/unsignedNumber";
import { unsignedIntegerType } from "./type/unsignedInteger";
import { integerType } from "./type/integer";
import { finiteType } from "./type/finite";
import { infinityType } from "./type/infinity";
import { nanType } from "./type/nan";
import { literalType } from "./type/literal";
import { nativeEnumType } from "./type/nativeEnum";
import { enumType } from "./type/enum";
import { unionType } from "./type/union";
import { nullableType } from "./type/nullable";
import { optionalType } from "./type/optional";
import { recordType } from "./type/record";
import { objectType } from "./type/object";
import { tupleType } from "./type/tuple";
import { mapType } from "./type/map";
import { setType } from "./type/set";
import { arrayType } from "./type/array";
import { undefinedType } from "./type/undefined";
import { nullType } from "./type/null";
import { functionType } from "./type/function";
import { symbolType } from "./type/symbol";
import { bigintType } from "./type/bigint";
import { booleanType } from "./type/boolean";
import { numberType } from "./type/number";
import { stringType } from "./type/string";
import { unknownType } from "./type/unknown";
import { neverType } from "./type/never";
import { promiseType } from "./type/promise";

export const t = {
never: neverType,
unknown: unknownType,
any: unknownType,
string: stringType,
number: numberType,
boolean: booleanType,
bigint: bigintType,
symbol: symbolType,
function: functionType,
null: nullType,
undefined: undefinedType,
void: undefinedType,
literal: literalType,
array: arrayType,
tuple: tupleType,
set: setType,
map: mapType,
object: objectType,
optional: optionalType,
nullable: nullableType,
union: unionType,
enum: enumType,
nativeEnum: nativeEnumType,
nan: nanType,
infinity: infinityType,
finite: finiteType,
integer: integerType,
int: integerType,
unsignedInteger: unsignedIntegerType,
uinteger: unsignedIntegerType,
uint: unsignedIntegerType,
unsignedNumber: unsignedNumberType,
unumber: unsignedNumberType,
instanceof: instanceofType,
date: dateType,
record: recordType,
promise: promiseType,
};
import * as lib from "./lib";
export * from "./lib";
export { lib as t };
export default lib;
4 changes: 4 additions & 0 deletions src/lib.ts
@@ -0,0 +1,4 @@
export * from "./errors";
export * from "./types";
export * from "./type";
export * from "./util";
47 changes: 47 additions & 0 deletions src/type/index.ts
@@ -0,0 +1,47 @@
export { arrayType as array } from "./array";
export { bigintType as bigint } from "./bigint";
export { booleanType as boolean } from "./boolean";
export { dateType as date } from "./date";
export { enumType as enum } from "./enum";
export { finiteType as finite } from "./finite";
export { infinityType as infinity } from "./infinity";
export { functionType as function } from "./function";
export { instanceofType as instanceof } from "./instanceof";
export { integerType as integer } from "./integer";
export { literalType as literal } from "./literal";
export { mapType as map } from "./map";
export { nanType as nan } from "./nan";
export { nativeEnumType as nativeEnum } from "./nativeEnum";
export { neverType as never } from "./never";
export { nullType as null } from "./null";
export { nullableType as nullable } from "./nullable";
export { numberType as number } from "./number";
export { objectType as object } from "./object";
export { optionalType as optional } from "./optional";
export { promiseType as promise } from "./promise";
export { recordType as record } from "./record";
export { setType as set } from "./set";
export { stringType as string } from "./string";
export { symbolType as symbol } from "./symbol";
export { tupleType as tuple } from "./tuple";
export { undefinedType as undefined } from "./undefined";
export { unionType as union } from "./union";
export { unknownType as unknown } from "./unknown";
export { unsignedIntegerType as unsignedInteger } from "./unsignedInteger";
export { unsignedNumberType as unsignedNumber } from "./unsignedNumber";

// Alias
import { integerType } from "./integer";
import { undefinedType } from "./undefined";
import { unknownType } from "./unknown";
import { unsignedIntegerType } from "./unsignedInteger";
import { unsignedNumberType } from "./unsignedNumber";

export {
integerType as int,
undefinedType as void,
unknownType as any,
unsignedIntegerType as uinteger,
unsignedIntegerType as uint,
unsignedNumberType as unumber,
};
2 changes: 2 additions & 0 deletions src/types.ts
Expand Up @@ -28,6 +28,8 @@ export type InferType<TType> = TType extends Type<infer TReturn>
? TReturn
: TType;

export type infer<TType> = InferType<TType>;

export type InferSchema<TSchema extends Schema> = {
[Key in keyof TSchema]: TSchema[Key] extends Schema
? InferSchema<TSchema[Key]>
Expand Down

0 comments on commit 63895c4

Please sign in to comment.