Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-gems

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-gems - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

lib/omit.d.ts

2

lib/common.d.ts

@@ -26,3 +26,3 @@ /**

*/
export type Builtin = Primitive | Function | String | Number | Date | Error | RegExp | JSON | Math |
export type Builtin = Primitive | Function | String | Number | Date | Error | RegExp |
ArrayBuffer | DataView | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array |

@@ -29,0 +29,0 @@ Int32Array | Uint32Array | Float32Array | Float64Array;

@@ -20,3 +20,3 @@ import {Builtin} from './common';

: T extends (infer U)[] ? DeepPartial<U>[]
: { [P in keyof T]?: DeepPartial<T[P]> };
: { [P in keyof T]?: DeepPartial<Exclude<T[P], undefined>> };

@@ -38,3 +38,3 @@ /**

: T extends (infer U)[] ? DeepBuildable<U>[]
: { -readonly [P in keyof T]?: DeepBuildable<T[P]> };
: { -readonly [P in keyof T]?: DeepBuildable<Exclude<T[P], undefined>> };

@@ -56,3 +56,3 @@ /**

: T extends (infer U)[] ? DeepRequired<U>[]
: { [P in keyof T]-?: DeepRequired<T[P]> };
: { [P in keyof T]-?: DeepRequired<Exclude<T[P], undefined>> };

@@ -75,3 +75,3 @@

: T extends (infer U)[] ? DeepReadonly<U>[]
: { readonly [P in keyof T]: DeepReadonly<T[P]> };
: { readonly [P in keyof T]: DeepReadonly<Exclude<T[P], undefined>> };

@@ -93,3 +93,3 @@ /**

: T extends (infer U)[] ? DeepWritable<U>[]
: { -readonly [P in keyof T]: DeepWritable<T[P]> };
: { -readonly [P in keyof T]: DeepWritable<Exclude<T[P], undefined>> };

@@ -99,3 +99,3 @@ /**

*/
export type DeepNullish<T> = _DeepNullish<T>;
export type DeepNullish<T> = _DeepNullish<DeepRequired<T>>;
type _DeepNullish<T> =

@@ -111,3 +111,3 @@ T extends Builtin ? T | null | undefined

: IfTuple<T> extends true ? { [K in OptionalKeys<T>]?: DeepNullish<T[K]> }
: T extends (infer U)[] ? DeepNullish<U>[]
: { [P in keyof T]-?: DeepNullish<T[P]> };
: T extends (infer U)[] ? DeepNullish<U>[] | null | undefined
: { [P in keyof T]: DeepNullish<T[P]>| null | undefined };

@@ -20,3 +20,3 @@ import {Builtin} from './common';

: T extends (infer U)[] ? DeepOmitOptional<U>[]
: { [P in K]: DeepOmitOptional<T[P]> };
: { [P in K]: DeepOmitOptional<Exclude<T[P], undefined>> };

@@ -38,3 +38,3 @@ /**

: T extends (infer U)[] ? DeepOmitRequired<U>[]
: { [P in J]: DeepOmitRequired<T[P]> };
: { [P in J]: DeepOmitRequired<Exclude<T[P], undefined>> };

@@ -56,3 +56,3 @@ /**

: T extends (infer U)[] ? DeepOmitReadonly<U>[]
: { [P in J]: DeepOmitReadonly<T[P]> };
: { [P in J]: DeepOmitReadonly<Exclude<T[P], undefined>> };

@@ -74,6 +74,6 @@ /**

: T extends (infer U)[] ? DeepOmitWritable<U>[]
: { [P in K]: DeepOmitWritable<T[P]> }
: { [P in K]: DeepOmitWritable<Exclude<T[P], undefined>> }
/**
* Omit all JSON properties in T deeply
* Omit all JSON friendly properties in T deeply
*/

@@ -92,2 +92,2 @@ export type DeepOmitJson<T> = _DeepOmitJson<T>

: T extends (infer U)[] ? DeepOmitJson<U>[]
: { [P in K]: DeepOmitJson<T[P]> };
: { [P in K]: DeepOmitJson<Exclude<T[P], undefined>> };

@@ -20,3 +20,3 @@ import {Builtin} from './common';

: T extends (infer U)[] ? DeepPickOptional<U>[]
: { [P in K]: DeepPickOptional<T[P]> };
: { [P in K]: DeepPickOptional<Exclude<T[P], undefined>> };

@@ -38,3 +38,3 @@ /**

: T extends (infer U)[] ? DeepPickRequired<U>[]
: { [P in J]: DeepPickRequired<T[P]> };
: { [P in J]: DeepPickRequired<Exclude<T[P], undefined>> };

@@ -56,3 +56,3 @@ /**

: T extends (infer U)[] ? DeepPickReadonly<U>[]
: { [P in J]: DeepPickReadonly<T[P]> };
: { [P in J]: DeepPickReadonly<Exclude<T[P], undefined>> };

@@ -74,6 +74,6 @@ /**

: T extends (infer U)[] ? DeepPickWritable<U>[]
: { [P in K]: DeepPickWritable<T[P]> }
: { [P in K]: DeepPickWritable<Exclude<T[P], undefined>> }
/**
* Pick all JSON properties in T deeply
* Pick all JSON friendly properties in T deeply
*/

@@ -92,2 +92,2 @@ export type DeepPickJson<T> = _DeepPickJson<T>

: T extends (infer U)[] ? DeepPickJson<U>[]
: { [P in K]: DeepPickJson<T[P]> };
: { [P in K]: DeepPickJson<Exclude<T[P], undefined>> };

@@ -7,1 +7,3 @@ export * from "./common";

export * from "./deep-omit";
export * from "./pick";
export * from "./omit";

@@ -15,2 +15,11 @@ import {IfEquals, IfCompatible, IfUndefined, IfAny, IfJson} from './type-check';

/**
* RequiredKeys
* @desc Returns required keys of an object
*/
export type RequiredKeys<T> = {
[K in keyof T]-?: IfUndefined<T[K]> extends true
? never
: T extends { [K1 in K]: any } ? K : never
}[keyof T];

@@ -21,11 +30,8 @@ /**

*/
export type OptionalKeys<T> = ValuesOf<{
[K in keyof T]-?: {} extends Pick<T, K> ? K : never;
}>;
export type OptionalKeys<T> = {
[K in keyof T]-?: IfUndefined<T[K]> extends true
? never
: T extends { [K1 in K]: any } ? never : K
}[keyof T];
/**
* RequiredKeys
* @desc Returns required keys of an object
*/
export type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T>>;

@@ -35,5 +41,5 @@ /**

*/
export type ReadonlyKeys<T> = ValuesOf<{
export type ReadonlyKeys<T> = {
[K in keyof T]-?: IfEquals<{ [Q in K]: T[K] }, { -readonly [Q in K]: T[K] }, never, K>
}>;
}[keyof T];

@@ -47,9 +53,14 @@ /**

/**
* @desc Returns non function keys of an object
* @desc Returns JSON friendly keys of an object
*/
export type JsonKeys<T> = ValuesOf<{
[K in keyof T]-?: IfUndefined<T[K]> extends false ?
K extends symbol ? never :
IfJson<T[K]> extends true ?
K : never : never;
export type JsonKeys<T> = _JsonKeys<T>;
type _JsonKeys<T, J = Required<T>> = ValuesOf<{
[K in keyof J]: IfUndefined<J[K]> extends true
? never
: K extends symbol
? never
: IfJson<J[K]> extends true
? K
: never
}>;

@@ -56,0 +67,0 @@

@@ -72,13 +72,11 @@ import {Primitive, Type} from './common';

export type IfJson<T, Y = true, N = false> =
IfNever<T> extends true ? N :
IfClass<T> extends true ? N :
IfFunction<T> extends true ? N :
IfUndefined<T> extends true ? N :
IfEquals<T, number> extends true ? Y :
IfEquals<T, string> extends true ? Y :
IfEquals<T, boolean> extends true ? Y :
IfEquals<T, null> extends true ? Y :
IfObject<T, Y> extends true ? Y :
T extends (infer U)[] ? IfJson<U> extends true ? Y : N
: N;
IfNull<T> extends true ? Y :
IfNever<T> extends true ? N :
IfUnknown<T> extends true ? N :
IfClass<T> extends true ? N :
IfFunction<T> extends true ? N :
IfUndefined<T> extends true ? N :
T extends symbol ? N :
T extends (infer U)[] ? IfJson<U> extends true ? Y : N
: Y;

@@ -85,0 +83,0 @@ export type IfJsonOrAny<T, Y = true, N = false> =

@@ -15,3 +15,3 @@ {

],
"version": "1.0.0",
"version": "1.1.0",
"types": "lib/index.d.ts",

@@ -36,7 +36,8 @@ "repository": "git@github.com:panates/ts-gems.git",

"devDependencies": {
"@types/jest": "^27.0.3",
"@types/jest": "^27.4.0",
"jest": "^27.4.7",
"prettier": "^2.5.1",
"ts-jest": "^27.1.2",
"typescript": "^4.5.4"
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc