Socket
Socket
Sign inDemoInstall

type-fest

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

type-fest - npm Package Compare versions

Comparing version 4.20.0 to 4.20.1

3

package.json
{
"name": "type-fest",
"version": "4.20.0",
"version": "4.20.1",
"description": "A collection of essential TypeScript types",

@@ -50,2 +50,3 @@ "license": "(MIT OR CC0-1.0)",

"rules": {
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/ban-ts-comment": "off",

@@ -52,0 +53,0 @@ "@typescript-eslint/ban-types": "off",

@@ -6,2 +6,4 @@ import type {StaticPartOfArray, VariablePartOfArray, NonRecursiveType, ToString} from './internal';

import type {UnknownArray} from './unknown-array';
import type {Sum} from './sum';
import type {LessThan} from './less-than';

@@ -49,3 +51,5 @@ /**

*/
export type Paths<T> =
export type Paths<T> = Paths_<T>;
type Paths_<T, Depth extends number = 0> =
T extends NonRecursiveType | ReadonlyMap<unknown, unknown> | ReadonlySet<unknown>

@@ -58,10 +62,10 @@ ? never

// We need to handle the fixed and non-fixed index part of the array separately.
? InternalPaths<StaticPartOfArray<T>>
| InternalPaths<Array<VariablePartOfArray<T>[number]>>
: InternalPaths<T>
? InternalPaths<StaticPartOfArray<T>, Depth>
| InternalPaths<Array<VariablePartOfArray<T>[number]>, Depth>
: InternalPaths<T, Depth>
: T extends object
? InternalPaths<T>
? InternalPaths<T, Depth>
: never;
export type InternalPaths<_T, T = Required<_T>> =
export type InternalPaths<_T, Depth extends number = 0, T = Required<_T>> =
T extends EmptyObject | readonly []

@@ -77,4 +81,6 @@ ? never

| (
IsNever<Paths<T[Key]>> extends false
? `${Key}.${Paths<T[Key]>}`
LessThan<Depth, 15> extends true // Limit the depth to prevent infinite recursion
? IsNever<Paths_<T[Key], Sum<Depth, 1>>> extends false
? `${Key}.${Paths_<T[Key], Sum<Depth, 1>>}`
: never
: never

@@ -81,0 +87,0 @@ )

@@ -50,17 +50,15 @@ /**

? ValueType
: ObjectType extends readonly unknown[]
? ValueType
: ObjectType extends unknown[]
: ObjectType extends Array<infer U>
? Array<Schema<U, ValueType>>
: ObjectType extends (...arguments_: unknown[]) => unknown
? ValueType
: ObjectType extends (...arguments_: unknown[]) => unknown
: ObjectType extends Date
? ValueType
: ObjectType extends Date
: ObjectType extends Function
? ValueType
: ObjectType extends Function
: ObjectType extends RegExp
? ValueType
: ObjectType extends RegExp
? ValueType
: ObjectType extends object
? SchemaObject<ObjectType, ValueType>
: ValueType;
: ObjectType extends object
? SchemaObject<ObjectType, ValueType>
: ValueType;

@@ -71,3 +69,5 @@ /**

type SchemaObject<ObjectType extends object, K> = {
[KeyType in keyof ObjectType]: Schema<ObjectType[KeyType], K> | K;
[KeyType in keyof ObjectType]: ObjectType[KeyType] extends readonly unknown[] | unknown[]
? Schema<ObjectType[KeyType], K>
: Schema<ObjectType[KeyType], K> | K;
};
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