X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftypings%2Futils.ts;h=24d43b2587007611a1836bc3a881e562e243f5c3;hb=66a36740044242568ae7868842eb36a920b21544;hp=a86b05be2d1bf273e2bca51377809aab9c8552b8;hpb=5224c394b3bbac6ec1543e41fa0ec6db436e84fa;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/typings/utils.ts b/server/typings/utils.ts index a86b05be2..24d43b258 100644 --- a/server/typings/utils.ts +++ b/server/typings/utils.ts @@ -1,3 +1,22 @@ -export type FunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T] +export type FunctionPropertyNames = { + [K in keyof T]: T[K] extends Function ? K : never +}[keyof T] export type FunctionProperties = Pick> + +export type PickWith = { + [P in KT]: T[P] extends V ? V : never +} + +export type PickWithOpt = { + [P in KT]?: T[P] extends V ? V : never +} + +// https://github.com/krzkaczor/ts-essentials Rocks! +export type DeepPartial = { + [P in keyof T]?: T[P] extends Array + ? Array> + : T[P] extends ReadonlyArray + ? ReadonlyArray> + : DeepPartial +}