Better prettier params (changelog ignore)
This commit is contained in:
@ -10,18 +10,12 @@ export declare namespace AndByDiscriminatingKey {
|
||||
U1,
|
||||
U1Again extends Record<DiscriminatingKey, string>,
|
||||
U2 extends Record<DiscriminatingKey, string>,
|
||||
> = U1 extends Pick<U2, DiscriminatingKey>
|
||||
? Tf2<DiscriminatingKey, U1, U2, U1Again>
|
||||
: U1;
|
||||
> = U1 extends Pick<U2, DiscriminatingKey> ? Tf2<DiscriminatingKey, U1, U2, U1Again> : U1;
|
||||
|
||||
export type Tf2<
|
||||
DiscriminatingKey extends string,
|
||||
SingletonU1 extends Record<DiscriminatingKey, string>,
|
||||
U2,
|
||||
U1 extends Record<DiscriminatingKey, string>,
|
||||
> = U2 extends Pick<SingletonU1, DiscriminatingKey>
|
||||
? U2 & SingletonU1
|
||||
: U2 extends Pick<U1, DiscriminatingKey>
|
||||
? never
|
||||
: U2;
|
||||
> = U2 extends Pick<SingletonU1, DiscriminatingKey> ? U2 & SingletonU1 : U2 extends Pick<U1, DiscriminatingKey> ? never : U2;
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
import type { FC, ComponentClass } from "react";
|
||||
|
||||
export type ReactComponent<Props extends Record<string, unknown> = {}> =
|
||||
| ((props: Props) => ReturnType<FC>)
|
||||
| ComponentClass<Props>;
|
||||
export type ReactComponent<Props extends Record<string, unknown> = {}> = ((props: Props) => ReturnType<FC>) | ComponentClass<Props>;
|
||||
|
@ -1,9 +1,5 @@
|
||||
import "minimal-polyfills/Object.fromEntries";
|
||||
|
||||
export function allPropertiesValuesToUndefined<
|
||||
T extends Record<string, unknown>,
|
||||
>(obj: T): Record<keyof T, undefined> {
|
||||
return Object.fromEntries(
|
||||
Object.entries(obj).map(([key]) => [key, undefined]),
|
||||
) as any;
|
||||
export function allPropertiesValuesToUndefined<T extends Record<string, unknown>>(obj: T): Record<keyof T, undefined> {
|
||||
return Object.fromEntries(Object.entries(obj).map(([key]) => [key, undefined])) as any;
|
||||
}
|
||||
|
@ -2,19 +2,13 @@ import { assert } from "tsafe/assert";
|
||||
import { is } from "tsafe/is";
|
||||
|
||||
//Warning: Be mindful that because of array this is not idempotent.
|
||||
export function deepAssign(params: {
|
||||
target: Record<string, unknown>;
|
||||
source: Record<string, unknown>;
|
||||
}) {
|
||||
export function deepAssign(params: { target: Record<string, unknown>; source: Record<string, unknown> }) {
|
||||
const { target, source } = params;
|
||||
|
||||
Object.keys(source).forEach(key => {
|
||||
var dereferencedSource = source[key];
|
||||
|
||||
if (
|
||||
target[key] === undefined ||
|
||||
!(dereferencedSource instanceof Object)
|
||||
) {
|
||||
if (target[key] === undefined || !(dereferencedSource instanceof Object)) {
|
||||
Object.defineProperty(target, key, {
|
||||
"enumerable": true,
|
||||
"writable": true,
|
||||
|
Reference in New Issue
Block a user