aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/core-utils/common/index.ts1
-rw-r--r--shared/core-utils/common/types.ts45
-rw-r--r--shared/extra-utils/server/config-command.ts2
3 files changed, 1 insertions, 47 deletions
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'
2export * from './miscs' 2export * from './miscs'
3export * from './regexp' 3export * from './regexp'
4export * from './promises' 4export * from './promises'
5export * from './types'
6export * from './url' 5export * 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 @@
1/* eslint-disable @typescript-eslint/array-type */
2
3export type FunctionPropertyNames<T> = {
4 [K in keyof T]: T[K] extends Function ? K : never
5}[keyof T]
6
7export type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>
8
9export type AttributesOnly<T> = {
10 [K in keyof T]: T[K] extends Function ? never : T[K]
11}
12
13export type PickWith<T, KT extends keyof T, V> = {
14 [P in KT]: T[P] extends V ? V : never
15}
16
17export type PickWithOpt<T, KT extends keyof T, V> = {
18 [P in KT]?: T[P] extends V ? V : never
19}
20
21// https://github.com/krzkaczor/ts-essentials Rocks!
22export type DeepPartial<T> = {
23 [P in keyof T]?: T[P] extends Array<infer U>
24 ? Array<DeepPartial<U>>
25 : T[P] extends ReadonlyArray<infer U>
26 ? ReadonlyArray<DeepPartial<U>>
27 : DeepPartial<T[P]>
28}
29
30type Primitive = string | Function | number | boolean | Symbol | undefined | null
31export type DeepOmitHelper<T, K extends keyof T> = {
32 [P in K]: // extra level of indirection needed to trigger homomorhic behavior
33 T[P] extends infer TP // distribute over unions
34 ? TP extends Primitive
35 ? TP // leave primitives and functions alone
36 : TP extends any[]
37 ? DeepOmitArray<TP, K> // Array special handling
38 : DeepOmit<TP, K>
39 : never
40}
41export type DeepOmit<T, K> = T extends Primitive ? T : DeepOmitHelper<T, Exclude<keyof T, K>>
42
43export type DeepOmitArray<T extends any[], K> = {
44 [P in keyof T]: DeepOmit<T[P], K>
45}
diff --git a/shared/extra-utils/server/config-command.ts b/shared/extra-utils/server/config-command.ts
index a061ca89e..89ae8eb4f 100644
--- a/shared/extra-utils/server/config-command.ts
+++ b/shared/extra-utils/server/config-command.ts
@@ -1,5 +1,5 @@
1import { merge } from 'lodash' 1import { merge } from 'lodash'
2import { DeepPartial } from '@shared/core-utils' 2import { DeepPartial } from '@shared/typescript-utils'
3import { About, HttpStatusCode, ServerConfig } from '@shared/models' 3import { About, HttpStatusCode, ServerConfig } from '@shared/models'
4import { CustomConfig } from '../../models/server/custom-config.model' 4import { CustomConfig } from '../../models/server/custom-config.model'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 5import { AbstractCommand, OverrideCommandOptions } from '../shared'