This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Init<T extends any[], TTail extends any[] = TailArray<T>> = CastArray<{ | |
[K in keyof TTail]: T[keyof T & K]; | |
}> | |
type PotentialArgs<T extends any[], TResult extends any[] = T> = { | |
"continue": PotentialArgs<Init<T>, TResult | Init<T>>; | |
"end": TResult; | |
}[T extends [] ? "end" : "continue"] | |
type Args<T extends Function> = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WHAT IS THIS? | |
// This is me playing around with a cool (but dirty) trick | |
// Some interfaces can be globally augmented to provide info to the type system | |
// This then allows some basic type switch and retrieval operations | |
// I needed a DeepReadonly<T> for a thing, I think I have it now | |
// Built/tested in 2.5.0-dev20170803 | |
// FUTURE PLANS | |
// - This needs lots of tidying and renaming | |
// - Do more stuff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: code now moved to https://github.com/tycho01/typical | |
// older revision left here, but it no longer runs well in TS Playground | |
export type Obj<T> = { [k: string]: T }; | |
export type NumObj<T> = { [k: number]: T }; | |
// export type List = ArrayLike; // no unapplied generic types :( | |
export type List<T> = ArrayLike<T>; | |
// progress: https://github.com/Microsoft/TypeScript/issues/16392 | |
export function force<T, V extends T>() {} |