katanabe / type-challenges Goto Github PK
View Code? Open in Web Editor NEWThis project forked from type-challenges/type-challenges
Collection of TypeScript type challenges with online judge
Home Page: https://tsch.js.org/
License: MIT License
This project forked from type-challenges/type-challenges
Collection of TypeScript type challenges with online judge
Home Page: https://tsch.js.org/
License: MIT License
type MyReadonly<T> = {
readonly [P in keyof T]: T[P]
}
type Length<T extends readonly any[]> = T["length"]
type MyExclude<T, K> = T extends K ? never : T;
type Permutation<T, K = T> = [T] extends [never] ?
[] :
K extends K?
[K, ...Permutation<Exclude<T, K>>] :
never;
type HelloWorld = string
type MyReturnType<T extends (...args: any[]) => any> = T extends (...args: any[]) => infer R ? R : any
type TupleToObject<T extends readonly PropertyKey[]> = {
[P in T[number]]: P;
}
type Includes<T extends readonly unknown[], U> =
T extends [infer first, ...infer rest] ?
Equal<first, U> extends true ?
true :
Includes<rest, U> :
false
type LookUp<U, T> = U extends {type: T} ? U : never;
type First<T extends any[]> = T extends [] ? never : T[0]
type First<T extends any[]> = T["length"] extends 0? never : T[0]
type First<T extends any[]> = T extends [infer A, ...any[]] ? A : never
type TupleToUnion<T> = T extends Array<infer U> ? U : never;
type Unshift<T extends unknown[], U> = [U, ...T]
type Pop<T extends any[]> = T extends [...infer I, infer _] ? I : [];
type ReplaceAll<S extends string, From extends string, To extends string> = From extends ''
? S
: S extends `${infer R1}${From}${infer R2}`
? `${R1}${To}${ReplaceAll<R2, From, To>}`
: S
type If<C extends boolean, T, F> = C extends true ? T : F;
type Push<T extends unknown[], U> = [...T, U]
type MyParameters<T extends (...args: any[]) => any> = T extends (...args: infer S) => any ? S : any
declare function PromiseAll<T extends any[]>(
values: readonly [...T]
): Promise<{ [key in keyof T]: Awaited<T[key]> }>
type Tupple = readonly unknown[];
type Concat<T extends Tupple, U extends Tupple> = [...T, ...U];
type Replace<S extends string, From extends string, To extends string> =
From extends '' ?
S :
S extends `${infer Before}${From}${infer After}` ?
`${Before}${To}${After}` :
S;
type MyAwaited<T> = T extends PromiseLike<infer V>
? V extends PromiseLike<any>
? MyAwaited<V>
: V
: never
type MyOmit<T, K extends keyof T> = {[P in Exclude<keyof T, K>]: T[P]};
type MyCapitalize<S extends string> = S extends `${infer first}${infer rest}` ? `${Uppercase<first>}${rest}`: S;
type Whitespace = '\n' | '\t' | ' ';
type Trim<S extends string> = S extends `${Whitespace}${infer U}` | `${infer U}${Whitespace}` ? Trim<U> : S;
type Whitespace = '\n' | '\t' | ' ';
type TrimLeft<S extends string> = S extends `${Whitespace}${infer U}` ? TrimLeft<U> : S;
type MyReadonly2<T, Kγextends keyof T = keyof T> = Omit<T, K> & Readonly<Pick<T, K>>;
type Last<T extends any[]> = [unknown, ...T][T["length"]];
type MyPick<T, K extends keyof T> = {
[P in K]: T[P]
}
type Chainable<T = {}> = {
option<K extends string, V>(
key: K extends keyof T ? never : K,
value: V
): Chainable<Omit<T, K> & Record<K, V>>;
get(): T;
}
type AppendArgument<Fn extends Function, A> =
Fn extends (...args: infer R) => infer T ?
(...args: [...R, A]) => T :
unknown;
type LengthOfString<S extends string, T extends string[] = []> =
S extends `${infer A}${infer B}` ?
LengthOfString<B, [A, ...T]> :
T["length"];
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.