From 6b5f72beda96d8b7e4d6329c4001827334de27dd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 16 Dec 2021 18:04:16 +0100 Subject: Move typescript utils in its own directory --- shared/core-utils/common/index.ts | 1 - shared/core-utils/common/types.ts | 45 --------------------------------------- 2 files changed, 46 deletions(-) delete mode 100644 shared/core-utils/common/types.ts (limited to 'shared/core-utils') diff --git a/shared/core-utils/common/index.ts b/shared/core-utils/common/index.ts index 0908ff981..5d3512148 100644 --- a/shared/core-utils/common/index.ts +++ b/shared/core-utils/common/index.ts @@ -2,5 +2,4 @@ export * from './date' export * from './miscs' export * from './regexp' export * from './promises' -export * from './types' export * from './url' diff --git a/shared/core-utils/common/types.ts b/shared/core-utils/common/types.ts deleted file mode 100644 index bd2a97b98..000000000 --- a/shared/core-utils/common/types.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* eslint-disable @typescript-eslint/array-type */ - -export type FunctionPropertyNames = { - [K in keyof T]: T[K] extends Function ? K : never -}[keyof T] - -export type FunctionProperties = Pick> - -export type AttributesOnly = { - [K in keyof T]: T[K] extends Function ? never : T[K] -} - -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 -} - -type Primitive = string | Function | number | boolean | Symbol | undefined | null -export type DeepOmitHelper = { - [P in K]: // extra level of indirection needed to trigger homomorhic behavior - T[P] extends infer TP // distribute over unions - ? TP extends Primitive - ? TP // leave primitives and functions alone - : TP extends any[] - ? DeepOmitArray // Array special handling - : DeepOmit - : never -} -export type DeepOmit = T extends Primitive ? T : DeepOmitHelper> - -export type DeepOmitArray = { - [P in keyof T]: DeepOmit -} -- cgit v1.2.3