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

@peersyst/react-types

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peersyst/react-types - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

67

index.d.ts

@@ -16,6 +16,4 @@ import { CSSProperties } from "react";

*/
export type OverridableStringUnion<
T extends string | number,
U = Record<string, any>,
> = GenerateStringUnion<Overwrite<Record<T, true>, U>>;
export type OverridableStringUnion<T extends string | number, U = Record<string, any>> =
GenerateStringUnion<Overwrite<Record<T, true>, U>>;

@@ -87,11 +85,64 @@ /**

/**
* Gets all keys with type undefined of T
* Get all keys with type T from O
*/
type UndefinedKeys<T> = {
[K in keyof T]: T[K] extends undefined ? K : never;
type TypeKeys<O, T> = {
[K in keyof O]: O[K] extends T ? K : never;
}[keyof T];
/**
* Removes properties of type T from O
*/
export type OmitType<O, T> = Omit<O, TypeKeys<O, T>>;
/**
* Gets all keys with type undefined of T
*/
type UndefinedKeys<T> = TypeKeys<T, undefined>;
/**
* Removes properties of type undefined from T
*/
type Defined<T> = Omit<T, UndefinedKeys<T>>;
type Defined<T> = OmitType<T, undefined>;
/**
* All possible iterations for a recursive type
*/
type MaxRecursiveIterations = 10;
// prettier-ignore
type Iterations = [never, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
/**
* Get nested keys from T in the form of key1.key2...
*/
type NestedKeys<T extends object> = CoreNestedKeys<T>;
type CoreNestedKeys<T extends object, I extends number = MaxRecursiveIterations> = I extends 0
? never
: {
[Key in keyof T]: T[Key] extends object
? `${Key}` | `${Key}.${NestedKeys<T[Key], Iterations[I]>}`
: Key;
}[Extract<keyof T, string>];
/**
* Get nested keys from T in the form of key1.key2...
*/
type FlattenedNestedKeys<T extends object> = FlattenedCoreNestedKeys<T>;
type FlattenedCoreNestedKeys<T extends object, I extends number = MaxRecursiveIterations> =
I extends 0
? never
: {
[Key in keyof T]: T[Key] extends object
? `${Key}.${NestedKeys<T[Key], Iterations[I]>}`
: Key;
}[Extract<keyof T, string>];
/**
* Pick K types from T with keys in the form of key1.key2...
*/
type DeepPick<T extends object, K extends NestedKeys<T>> = CoreDeepPick<T, K>;
type CoreDeepPick<T extends object, K extends string, I extends number = MaxRecursiveIterations> =
I extends 0
? never
: K extends `${infer FirstKey}.${infer RestKey}`
? CoreDeepPick<T[FirstKey], RestKey, Iterations[I]>
: T[K];

2

package.json
{
"name": "@peersyst/react-types",
"author": "Peersyst",
"version": "1.4.0",
"version": "1.5.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "types": "./index.d.ts",

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