hkt-toolbelt
Advanced tools
Comparing version 0.11.0 to 0.12.0
@@ -1,5 +0,1 @@ | ||
import { Kind, List } from "."; | ||
export declare type $<F extends Kind, X extends Kind.InputOf<F>> = ReturnType<(F & { | ||
readonly [Kind._]: X; | ||
})["f"]>; | ||
export declare type $$<FX extends Kind[], X extends FX extends [] ? unknown : Kind.InputOf<List._$first<FX>>> = Kind._$pipe<FX, X>; | ||
export * from "./$/"; |
@@ -1,20 +0,1 @@ | ||
import { Cast, Kind } from "."; | ||
export declare type _$and<T extends boolean, U extends boolean> = [T, U] extends [ | ||
true, | ||
true | ||
] ? true : false; | ||
export declare abstract class And<T extends boolean> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], boolean>) => _$and<T, typeof x>; | ||
} | ||
export declare type _$or<T extends boolean, U extends boolean> = [T, U] extends [ | ||
false, | ||
false | ||
] ? false : true; | ||
export declare abstract class Or<T extends boolean> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], boolean>) => _$or<T, typeof x>; | ||
} | ||
export declare type _$not<T extends boolean> = T extends true ? false : true; | ||
export declare abstract class Not extends Kind { | ||
abstract f: (x: Cast<this[Kind._], boolean>) => _$not<typeof x>; | ||
} | ||
export * as Boolean from "./boolean"; | ||
export * from "./boolean/"; |
@@ -1,11 +0,1 @@ | ||
import $, { Cast, Kind } from "."; | ||
export declare abstract class Self extends Kind { | ||
abstract f: (x: this[Kind._]) => Self; | ||
} | ||
declare abstract class RecursiveKind extends Kind { | ||
abstract f: (x: Cast<this[Kind._], RecursiveKind>) => unknown; | ||
} | ||
export declare abstract class ApplySelf extends Kind { | ||
abstract f: (x: Cast<this[Kind._], RecursiveKind>) => $<typeof x, Cast<typeof x, Kind.InputOf<typeof x>>>; | ||
} | ||
export * as Combinator from "./combinator"; | ||
export * from "./combinator/"; |
@@ -1,21 +0,1 @@ | ||
import $, { Cast, Function, Kind } from "."; | ||
export declare type _$equals<T, U> = [T, U] extends [U, T] ? true : false; | ||
export declare abstract class Equals<T> extends Kind { | ||
abstract f: (x: this[Kind._]) => _$equals<T, typeof x>; | ||
} | ||
export declare type _$extends<Super, X> = (X extends unknown ? X : never) extends Super ? true : false; | ||
export declare abstract class Extends<Super> extends Kind { | ||
abstract f: (x: this[Kind._]) => _$extends<Super, typeof x>; | ||
} | ||
/** | ||
* @alias `Extends<T>` | ||
* @deprecated | ||
*/ | ||
export declare abstract class SubtypeOf<Super> extends Kind { | ||
abstract f: (x: this[Kind._]) => _$extends<Super, typeof x>; | ||
} | ||
export declare type _$if<Predicate extends Kind<(x: never) => boolean>, Then extends Kind, Else extends Kind, X extends Kind.InputOf<Predicate>> = $<Predicate, X> extends true ? $<Then, Cast<X, Kind.InputOf<Then>>> : $<Else, Cast<X, Kind.InputOf<Else>>>; | ||
export declare abstract class If<Predicate extends Kind<(x: never) => boolean>, Then extends Kind, Else extends Kind = Function.Constant<never>> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind.InputOf<Predicate>>) => _$if<Predicate, Then, Else, typeof x>; | ||
} | ||
export * as Conditional from "./conditional"; | ||
export * from "./conditional/"; |
@@ -1,10 +0,1 @@ | ||
import { Kind } from "."; | ||
export declare namespace Function { | ||
abstract class Constant<X> extends Kind { | ||
abstract f: (x: this[Kind._]) => X; | ||
} | ||
abstract class Identity extends Kind { | ||
abstract f: (x: this[Kind._]) => typeof x; | ||
} | ||
} | ||
export declare type Function = (...x: never[]) => unknown; | ||
export * from "./function/"; |
101
index.d.ts
@@ -1,15 +0,88 @@ | ||
export { Boolean } from "./boolean"; | ||
export { Cast } from "./cast"; | ||
export { Combinator } from "./combinator"; | ||
export { Conditional } from "./conditional"; | ||
export { Function } from "./function"; | ||
export * from "./kind"; | ||
export { List } from "./list"; | ||
export { Object } from "./object"; | ||
export { String } from "./string"; | ||
export { Test } from "./test"; | ||
export { Type } from "./type"; | ||
export { Union } from "./union"; | ||
export { $, $$ } from "./$"; | ||
import { $ } from "./$"; | ||
export default $; | ||
import * as Boolean from "./boolean"; | ||
export * as Boolean from "./boolean"; | ||
import * as Combinator from "./combinator"; | ||
export * as Combinator from "./combinator"; | ||
import * as Conditional from "./conditional"; | ||
export * as Conditional from "./conditional"; | ||
import * as Function from "./function"; | ||
export * as Function from "./function"; | ||
import * as Kind from "./kind"; | ||
export * as Kind from "./kind"; | ||
import * as List from "./list"; | ||
export * as List from "./list"; | ||
import * as Object from "./object"; | ||
export * as Object from "./object"; | ||
import * as String from "./string"; | ||
export * as String from "./string"; | ||
import * as Test from "./test"; | ||
export * as Test from "./test"; | ||
import * as Type from "./type"; | ||
export * as Type from "./type"; | ||
import * as Union from "./union"; | ||
export * as Union from "./union"; | ||
declare const _default: { | ||
ToIntersection: typeof Union.ToIntersection; | ||
ToList: typeof Union.ToList; | ||
Cast: typeof Type.Cast; | ||
Display: typeof Type.Display; | ||
ValueOf: typeof Type.ValueOf; | ||
_: typeof Test._; | ||
Append: typeof String.Append; | ||
EndsWith: typeof String.EndsWith; | ||
First: typeof String.First; | ||
Includes: typeof String.Includes; | ||
Init: typeof String.Init; | ||
IsString: typeof String.IsString; | ||
IsTemplate: typeof String.IsTemplate; | ||
Join: typeof String.Join; | ||
Last: typeof String.Last; | ||
Prepend: typeof String.Prepend; | ||
Replace: typeof String.Replace; | ||
Reverse: typeof String.Reverse; | ||
Split: typeof String.Split; | ||
StartsWith: typeof String.StartsWith; | ||
Tail: typeof String.Tail; | ||
ToLower: typeof String.ToLower; | ||
ToUpper: typeof String.ToUpper; | ||
AtPath: typeof Object.AtPath; | ||
At: typeof Object.At; | ||
DeepInputOf: typeof Object.DeepInputOf; | ||
DeepMapValues: typeof Object.DeepMapValues; | ||
Keys: typeof Object.Keys; | ||
MapKeys: typeof Object.MapKeys; | ||
MapValues: typeof Object.MapValues; | ||
Paths: typeof Object.Paths; | ||
Values: typeof Object.Values; | ||
Every: typeof List.Every; | ||
Filter: typeof List.Filter; | ||
Find: typeof List.Find; | ||
IsVariadic: typeof List.IsVariadic; | ||
Map: typeof List.Map; | ||
Pair: typeof List.Pair; | ||
Pop: typeof List.Pop; | ||
Push: typeof List.Push; | ||
Shift: typeof List.Shift; | ||
Some: typeof List.Some; | ||
Unshift: typeof List.Unshift; | ||
Apply: typeof Kind.Apply; | ||
ComposablePair: typeof Kind.ComposablePair; | ||
Composable: typeof Kind.Composable; | ||
Compose: typeof Kind.Compose; | ||
InputOf: typeof Kind.InputOf; | ||
Kind: typeof Kind.Kind; | ||
OutputOf: typeof Kind.OutputOf; | ||
Pipe: typeof Kind.Pipe; | ||
Constant: typeof Function.Constant; | ||
Identity: typeof Function.Identity; | ||
Equals: typeof Conditional.Equals; | ||
Extends: typeof Conditional.Extends; | ||
If: typeof Conditional.If; | ||
ApplySelf: typeof Combinator.ApplySelf; | ||
RecursiveKind: typeof Combinator.RecursiveKind; | ||
Self: typeof Combinator.Self; | ||
And: typeof Boolean.And; | ||
Not: typeof Boolean.Not; | ||
Or: typeof Boolean.Or; | ||
}; | ||
export default _default; |
@@ -1,49 +0,1 @@ | ||
import $, { Cast, Function, List } from "."; | ||
export declare namespace Kind { | ||
const _: unique symbol; | ||
type _ = typeof _; | ||
type _$compose<FX extends Kind[], X> = FX extends [ | ||
...infer Init, | ||
infer Last | ||
] ? _$compose<Cast<Init, Kind[]>, $<Cast<Last, Kind>, Cast<X, InputOf<Cast<Last, Kind>>>>> : X; | ||
type _$composablePair<F extends [Kind, Kind]> = Kind.OutputOf<F[1]> extends Kind.InputOf<F[0]> ? true : false; | ||
abstract class ComposablePair extends Kind { | ||
abstract f: (x: Cast<this[Kind._], [Kind, Kind]>) => _$composablePair<typeof x>; | ||
} | ||
type _$composable<FX extends Kind[]> = List._$every<Kind.ComposablePair, List._$pair<FX>>; | ||
abstract class Composable extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind[]>) => _$composable<typeof x>; | ||
} | ||
abstract class Compose<FX extends _$composable<FX> extends true ? Kind[] : never> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], FX extends [] ? unknown : InputOf<List._$last<FX>>>) => _$compose<FX, typeof x>; | ||
} | ||
type _$pipe<FX extends Kind[], X> = _$compose<List._$reverse<FX>, X>; | ||
abstract class Pipe<FX extends _$composable<List._$reverse<FX>> extends true ? Kind[] : never> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], FX extends [] ? unknown : InputOf<List._$first<FX>>>) => _$pipe<FX, typeof x>; | ||
} | ||
abstract class Apply<X> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind<(x: X) => unknown>>) => $<typeof x, Cast<X, InputOf<typeof x>>>; | ||
} | ||
type InputOf<F extends Kind> = F extends { | ||
f: (x: infer X) => unknown; | ||
} ? X : unknown; | ||
type OutputOf<F extends Kind> = F extends { | ||
f: (x: never) => infer X; | ||
} ? X : unknown; | ||
} | ||
export declare const Composable: typeof Kind.Composable; | ||
export declare type Composable = Kind.Composable; | ||
export declare const Compose: typeof Kind.Compose; | ||
export declare type Compose<FX extends Kind._$composable<FX> extends true ? Kind[] : never> = Kind.Compose<FX>; | ||
export declare const Pipe: typeof Kind.Pipe; | ||
export declare type Pipe<FX extends Kind._$composable<List._$reverse<FX>> extends true ? Kind[] : never> = Kind.Pipe<FX>; | ||
export declare const Apply: typeof Kind.Apply; | ||
export declare type Apply<X> = Kind.Apply<X>; | ||
export declare type InputOf<F extends Kind> = Kind.InputOf<F>; | ||
export declare type OutputOf<F extends Kind> = Kind.OutputOf<F>; | ||
declare const Kind_: typeof Kind; | ||
export declare abstract class Kind<F extends Function = Function> { | ||
abstract readonly [Kind_._]: unknown; | ||
abstract f: F; | ||
} | ||
export default Kind; | ||
export * from "./kind/"; |
@@ -1,66 +0,1 @@ | ||
import $, { Boolean, Cast, Kind } from "."; | ||
export declare type _$map<F extends Kind, X extends unknown[]> = { | ||
[key in keyof X]: $<F, Cast<X[key], Kind.InputOf<F>>>; | ||
}; | ||
export declare abstract class Map<F extends Kind> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$map<F, typeof x>; | ||
} | ||
export declare type _$find<F extends Kind, X extends unknown[]> = X extends [ | ||
infer Head, | ||
...infer Tail | ||
] ? $<F, Cast<Head, Kind.InputOf<F>>> extends true ? Head : _$find<F, Tail> : never; | ||
export declare abstract class Find<F extends Kind<(x: never) => boolean>> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind.InputOf<F>[]>) => _$find<F, typeof x>; | ||
} | ||
export declare type _$filter<F extends Kind, X extends unknown[], O extends unknown[] = []> = X extends [infer Head, ...infer Tail] ? $<F, Cast<Head, Kind.InputOf<F>>> extends true ? _$filter<F, Tail, [...O, Head]> : _$filter<F, Tail, O> : O; | ||
export declare abstract class Filter<F extends Kind<(x: never) => boolean>> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind.InputOf<F>[]>) => _$filter<F, typeof x>; | ||
} | ||
export declare type _$includes<F extends Kind, X extends unknown[]> = X extends [ | ||
infer Head, | ||
...infer Tail | ||
] ? $<F, Cast<Head, Kind.InputOf<F>>> extends true ? true : _$includes<F, Tail> : false; | ||
export declare abstract class Includes<F extends Kind<(x: never) => boolean>> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind.InputOf<F>[]>) => _$includes<F, typeof x>; | ||
} | ||
export declare type _$push<X, T extends unknown[]> = [...T, X]; | ||
export declare abstract class Push<X> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$push<X, typeof x>; | ||
} | ||
export declare type _$unshift<X, T extends unknown[]> = [X, ...T]; | ||
export declare abstract class Unshift<X> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$unshift<X, typeof x>; | ||
} | ||
export declare type _$first<T extends unknown[]> = T extends [] ? never : T[0]; | ||
export declare abstract class First extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$first<typeof x>; | ||
} | ||
export declare type _$last<T extends unknown[]> = T extends [infer X] ? X : T extends [unknown, ...infer Tail] ? _$last<Tail> : T extends [...unknown[], infer X] ? X : T[number]; | ||
export declare abstract class Last extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$last<typeof x>; | ||
} | ||
export declare type _$pair<T extends unknown[], O extends unknown[][] = []> = T extends [infer X1, infer X2, ...infer Rest] ? _$pair<[X2, ...Rest], [...O, [X1, X2]]> : number extends T["length"] ? [T[number], T[number]][] : O; | ||
export declare abstract class Pair extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$pair<typeof x>; | ||
} | ||
export declare type _$every<F extends Kind<(x: never) => boolean>, T extends unknown[], O extends boolean = true> = T extends [infer Head, ...infer Rest] ? _$every<F, Rest, Boolean._$and<O, $<F, Cast<Head, Kind.InputOf<F>>>>> : O; | ||
export declare abstract class Every<F extends Kind<(x: never) => boolean>> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind.InputOf<F>[]>) => _$every<F, typeof x>; | ||
} | ||
export declare type _$some<F extends Kind<(x: never) => boolean>, T extends unknown[], O extends boolean = false> = T extends [infer Head, ...infer Rest] ? _$some<F, Rest, Boolean._$or<O, $<F, Cast<Head, Kind.InputOf<F>>>>> : O; | ||
export declare abstract class Some<F extends Kind<(x: never) => boolean>> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Kind.InputOf<F>[]>) => _$some<F, typeof x>; | ||
} | ||
declare type _$reverse2<T extends unknown[], O extends unknown[] = []> = T extends [ | ||
...infer Init, | ||
infer Last | ||
] ? Init extends [] ? [...O, Last] : _$reverse2<Init, [...O, Last]> : T extends [infer Head, ...unknown[]] ? Head : [...O, ...T]; | ||
export declare type _$reverse<T extends unknown[], O extends unknown[] = []> = T extends [infer Head, ...infer Tail] ? _$reverse<Tail, [Head, ...O]> : T extends [] ? O : [..._$reverse2<T>, ...O]; | ||
export declare abstract class Reverse extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$reverse<typeof x>; | ||
} | ||
export declare type _$isVariadic<T extends unknown[]> = number extends T["length"] ? true : false; | ||
export declare abstract class IsVariadic extends Kind { | ||
abstract f: (x: Cast<this[Kind._], unknown[]>) => _$isVariadic<typeof x>; | ||
} | ||
export * as List from "./list"; | ||
export * from "./list/"; |
@@ -1,51 +0,1 @@ | ||
import $, { Cast, Kind, Type, Union } from "."; | ||
export declare type _$keys<T extends Record<string, unknown>> = Union._$toTuple<keyof T>; | ||
export declare abstract class Keys extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Record<string, unknown>>) => _$keys<typeof x>; | ||
} | ||
export declare type _$values<T extends Record<string, unknown>, Keys = _$keys<T>> = { | ||
[key in keyof Keys]: T[Cast<Keys[key], keyof T>]; | ||
}; | ||
export declare abstract class Values extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Record<string, unknown>>) => _$values<typeof x>; | ||
} | ||
export declare type _$mapKeys<T extends Record<string, unknown>, F extends Kind> = { | ||
[key in keyof T as $<F, Cast<key, Kind.InputOf<F>>>]: T[key]; | ||
}; | ||
export declare abstract class MapKeys<F extends Kind<(x: string) => string>> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Record<string, unknown>>) => _$mapKeys<typeof x, F>; | ||
} | ||
export declare type _$mapValues<T extends Record<string, unknown>, F extends Kind> = { | ||
[key in keyof T]: $<F, Cast<T[key], Kind.InputOf<F>>>; | ||
}; | ||
export declare abstract class MapValues<F extends Kind> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Record<string, Kind.InputOf<F>>>) => _$mapValues<typeof x, F>; | ||
} | ||
declare type RecursiveKindInput<F extends Kind> = Kind.InputOf<F> | Record<string, Kind.InputOf<F>> | { | ||
[key: string]: RecursiveKindInput<F>; | ||
}; | ||
export declare type _$deepMap<F extends Kind, O> = { | ||
[key in keyof O]: Type._$display<O[key] extends Record<string, unknown> ? _$deepMap<F, O[key]> : $<F, Cast<O[key], Kind.InputOf<F>>>>; | ||
}; | ||
export declare abstract class DeepMap<F extends Kind> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], RecursiveKindInput<F>>) => _$deepMap<F, typeof x>; | ||
} | ||
declare type _$paths2<T, O extends unknown[] = []> = { | ||
[K in keyof T]: T[K] extends Record<string, unknown> ? _$paths2<T[K], [...O, K]> : [...O, K]; | ||
}[keyof T] | O; | ||
export declare type _$paths<T, U = _$paths2<T>> = Union._$toTuple<U extends [] ? never : U>; | ||
export declare abstract class Paths extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Record<string, unknown>>) => _$paths<typeof x>; | ||
} | ||
export declare type _$at<K extends keyof T, T extends Record<string, unknown>> = T[K]; | ||
export declare abstract class At<K extends string | symbol> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Record<K, unknown>>) => _$at<K, typeof x>; | ||
} | ||
export declare type _$atPath<Path extends (string | symbol)[], T> = Path extends [ | ||
infer Head, | ||
...infer Tail | ||
] ? Tail extends [] ? Head extends keyof T ? T[Head] : never : _$atPath<Cast<Tail, (string | symbol)[]>, T[Cast<Head, keyof T>]> : never; | ||
export declare abstract class AtPath<Path extends (string | symbol)[]> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], Record<string, unknown>>) => _$atPath<Path, typeof x>; | ||
} | ||
export * as Object from "./object"; | ||
export * from "./object/"; |
{ | ||
"name": "hkt-toolbelt", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "Functional and composable type utilities", | ||
@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts", |
@@ -49,3 +49,3 @@ <a href="https://github.com/poteat/hkt-toolbelt#readme"> | ||
```ts | ||
import $, { List, Conditional } from "hkt-toolbelt"; | ||
import { $, List, Conditional } from "hkt-toolbelt"; | ||
@@ -52,0 +52,0 @@ type Result = $< |
@@ -1,73 +0,1 @@ | ||
import { Cast, Conditional, Kind, List } from "."; | ||
export declare type _$startsWith<Prefix extends string, S extends string> = S extends `${Prefix}${string}` ? true : false; | ||
export declare abstract class StartsWith<Prefix extends string> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$startsWith<Prefix, typeof x>; | ||
} | ||
export declare type _$endsWith<Suffix extends string, S extends string> = S extends `${string}${Suffix}` ? true : false; | ||
export declare abstract class EndsWith<Suffix extends string> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$endsWith<Suffix, typeof x>; | ||
} | ||
export declare type _$includes<Infix extends string, S extends string> = S extends `${string}${Infix}${string}` ? true : false; | ||
export declare abstract class Includes<Infix extends string> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$includes<Infix, typeof x>; | ||
} | ||
export declare type _$append<Suffix extends string, S extends string> = `${S}${Suffix}`; | ||
export declare abstract class Append<Suffix extends string> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$append<Suffix, typeof x>; | ||
} | ||
export declare type _$prepend<Prefix extends string, S extends string> = `${Prefix}${S}`; | ||
export declare abstract class Prepend<Prefix extends string> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$prepend<Prefix, typeof x>; | ||
} | ||
declare type _$simpleSplit<S extends string, O extends string[] = []> = string extends S ? [string] : S extends `${infer Head}${infer Tail}` ? _$simpleSplit<Tail, [...O, Head]> : O; | ||
export declare type _$isTemplate<S extends string> = string extends S ? false : List._$some<Conditional.Equals<string>, _$simpleSplit<S>>; | ||
export declare abstract class IsTemplate extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$isTemplate<typeof x>; | ||
} | ||
export declare type _$join<T extends string[], D extends string = "", O extends string = ""> = List._$isVariadic<T> extends true ? string : T extends [infer Head, ...infer Tail] ? Tail extends [] ? `${O}${D}${Cast<Head, string>}` : _$join<Cast<Tail, string[]>, D, `${O}${O extends "" ? "" : D}${Cast<Head, string>}`> : string[] extends T ? `${O}${string}` : O; | ||
export declare abstract class Join<D extends string = ""> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string[]>) => _$join<typeof x, D>; | ||
} | ||
export declare type _$split<S extends string, Delimiter extends string = "", O extends unknown[] = []> = _$isTemplate<Delimiter> extends true ? string[] : string extends Delimiter ? string[] : S extends `${infer Head}${Delimiter}${infer Tail}` ? _$split<Tail, Delimiter, [...O, Head]> : S extends Delimiter ? O : [...O, S]; | ||
export declare abstract class Split<Delimiter extends string = ""> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$split<typeof x, Delimiter>; | ||
} | ||
export declare type _$first<S extends string> = S extends `${infer Head}${string}` ? Head : string extends S ? S : ""; | ||
export declare abstract class First extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$first<typeof x>; | ||
} | ||
export declare type _$last<S extends string> = S extends `${string}${infer Tail}` ? Tail extends "" ? S : _$last<Tail> : string extends S ? S : ""; | ||
export declare abstract class Last extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$last<typeof x>; | ||
} | ||
export declare type _$tail<S extends string> = S extends `${string}${infer Tail}` ? Tail extends "" ? S : Tail : string extends S ? S : ""; | ||
export declare abstract class Tail extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$tail<typeof x>; | ||
} | ||
declare type _$init2<S extends string, O extends string = ""> = S extends `${infer Head}${infer Tail}` ? Tail extends "" ? O : _$init2<Tail, `${O}${Head}`> : O; | ||
export declare type _$init<S extends string> = string extends S ? string : _$init2<S>; | ||
export declare abstract class Init extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$init<typeof x>; | ||
} | ||
declare type _$replace2<S extends string, From extends string, To extends string, O extends string = ""> = S extends `${infer Head}${From}${infer Tail}` ? _$replace2<Tail, From, To, `${O}${Head}${To}`> : `${O}${S}`; | ||
export declare type _$replace<S extends string, From extends string, To extends string> = _$isTemplate<From> extends true ? string : string extends From ? string : From extends "" ? `${To}${_$replace2<S, From, To>}` : _$replace2<S, From, To>; | ||
export declare abstract class Replace<From extends string, To extends string> extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$replace<typeof x, From, To>; | ||
} | ||
export declare type _$reverse<S extends string, O extends string = ""> = S extends `${infer Head}${infer Tail}` ? _$reverse<Tail, `${Head}${O}`> : `${string extends S ? string : ""}${O}`; | ||
export declare abstract class Reverse extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$reverse<typeof x>; | ||
} | ||
export declare type _$isString<S extends unknown> = S extends string ? true : false; | ||
export declare abstract class IsString extends Kind { | ||
abstract f: (x: this[Kind._]) => _$isString<typeof x>; | ||
} | ||
export declare type _$toUpper<S extends string> = Uppercase<S>; | ||
export declare abstract class ToUpper extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$toUpper<typeof x>; | ||
} | ||
export declare type _$toLower<S extends string> = Lowercase<S>; | ||
export declare abstract class ToLower extends Kind { | ||
abstract f: (x: Cast<this[Kind._], string>) => _$toLower<typeof x>; | ||
} | ||
export * as String from "./string"; | ||
export * from "./string/"; |
@@ -1,8 +0,1 @@ | ||
import { Conditional } from "."; | ||
declare type IsNever<X> = Conditional._$equals<X, never>; | ||
declare abstract class _ { | ||
abstract readonly _: symbol; | ||
} | ||
export declare type Expect<X extends Conditional._$equals<X, V> extends true ? V : V & _, V = true> = IsNever<V> extends true ? X : IsNever<X> extends true ? Expect<X, V> : X; | ||
export declare type ExpectNot<X extends Conditional._$equals<X, V> extends true ? V : V & _, V = false> = IsNever<V> extends true ? X : IsNever<X> extends true ? ExpectNot<X, V> : X; | ||
export * as Test from "./test"; | ||
export * from "./test/"; |
@@ -1,12 +0,1 @@ | ||
import { Kind } from "."; | ||
export declare type _$display<T> = T extends (...args: never[]) => unknown ? T : T extends abstract new (...args: never[]) => unknown ? T : { | ||
[key in keyof T]: T[key]; | ||
}; | ||
export declare abstract class Display extends Kind { | ||
abstract f: (x: this[Kind._]) => _$display<this[Kind._]>; | ||
} | ||
export declare type _$valueOf<T> = T extends unknown[] ? T[number] : T[keyof T]; | ||
export declare abstract class ValueOf extends Kind { | ||
abstract f: (x: this[Kind._]) => _$valueOf<typeof x>; | ||
} | ||
export * as Type from "./type"; | ||
export * from "./type/"; |
@@ -1,11 +0,1 @@ | ||
import { Kind } from "."; | ||
export declare type _$toIntersection2<T> = (T extends unknown ? (x: T) => unknown : never) extends (x: infer X) => void ? X : never; | ||
export declare type _$toIntersection<T> = boolean extends T ? boolean & _$toIntersection2<Exclude<T, boolean>> : _$toIntersection2<T>; | ||
export declare abstract class ToIntersection extends Kind { | ||
abstract f: (x: this[Kind._]) => _$toIntersection<this[Kind._]>; | ||
} | ||
export declare type _$toTuple<T, O extends unknown[] = []> = _$toIntersection<T extends unknown ? (t: T) => T : never> extends (x: never) => infer X ? _$toTuple<Exclude<T, X>, [X, ...O]> : O; | ||
export declare abstract class ToTuple extends Kind { | ||
abstract f: (x: this[Kind._]) => _$toTuple<this[Kind._]>; | ||
} | ||
export * as Union from "./union"; | ||
export * from "./union/"; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
31204
100
575
1