Socket
Socket
Sign inDemoInstall

type-fest

Package Overview
Dependencies
0
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.12.0 to 3.13.0

source/has-readonly-keys.d.ts

2

index.d.ts

@@ -82,3 +82,5 @@ // Basic

export type {ReadonlyKeysOf} from './source/readonly-keys-of';
export type {HasReadonlyKeys} from './source/has-readonly-keys';
export type {WritableKeysOf} from './source/writable-keys-of';
export type {HasWritableKeys} from './source/has-writable-keys';
export type {Spread} from './source/spread';

@@ -85,0 +87,0 @@ export type {TupleToUnion} from './source/tuple-to-union';

2

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

@@ -5,0 +5,0 @@ "license": "(MIT OR CC0-1.0)",

@@ -147,4 +147,6 @@ <div align="center">

- [`HasRequiredKeys`](source/has-required-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any required fields.
- [`ReadonlyKeysOf`](source/readonly-keys-of.d.ts) - Extract all writable (non-readonly) keys from the given type.
- [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all readonly keys from the given type.
- [`ReadonlyKeysOf`](source/readonly-keys-of.d.ts) - Extract all readonly keys from the given type.
- [`HasReadonlyKeys`](source/has-readonly-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any readonly fields.
- [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable (non-readonly) keys from the given type.
- [`HasWritableKeys`](source/has-writable-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any writable fields.
- [`Spread`](source/spread.d.ts) - Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax.

@@ -151,0 +153,0 @@ - [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal.

@@ -6,3 +6,6 @@ /**

*/
export type Class<T, Arguments extends unknown[] = any[]> = Constructor<T, Arguments> & {prototype: T};
export type Class<T, Arguments extends unknown[] = any[]> = {
prototype: T;
new(...arguments_: Arguments): T;
};

@@ -20,4 +23,10 @@ /**

@category Class
@privateRemarks
We cannot use a `type` here because TypeScript throws: 'abstract' modifier cannot appear on a type member. (1070)
*/
export type AbstractClass<T, Arguments extends unknown[] = any[]> = AbstractConstructor<T, Arguments> & {prototype: T};
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export interface AbstractClass<T, Arguments extends unknown[] = any[]> extends AbstractConstructor<T, Arguments> {
prototype: T;
}

@@ -24,0 +33,0 @@ /**

import type {JsonPrimitive, JsonValue} from './basic';
import type {EmptyObject} from './empty-object';
import type {UndefinedToOptional} from './internal';
import type {IsAny} from './is-any';
import type {IsNever} from './is-never';
import type {NegativeInfinity, PositiveInfinity} from './numeric';
import type {TypedArray} from './typed-array';
import type {IsAny} from './is-any';

@@ -11,6 +12,15 @@ // Note: The return value has to be `any` and not `unknown` so it can match `void`.

type JsonifyTuple<T extends [unknown, ...unknown[]]> = {
[Key in keyof T]: T[Key] extends NotJsonable ? null : Jsonify<T[Key]>;
};
type FilterNonNever<T extends unknown[]> = T extends [infer F, ...infer R]
? IsNever<F> extends true
? FilterNonNever<R>
: [F, ...FilterNonNever<R>]
: IsNever<T[number]> extends true
? []
: T;
// Handles tuples and arrays
type JsonifyList<T extends unknown[]> = T extends [infer F, ...infer R]
? FilterNonNever<[Jsonify<F>, ...JsonifyList<R>]>
: Array<Jsonify<T[number]>>;
type FilterJsonableKeys<T extends object> = {

@@ -111,3 +121,3 @@ [Key in keyof T]: T[Key] extends NotJsonable ? never : Key;

: T extends [unknown, ...unknown[]]
? JsonifyTuple<T>
? JsonifyList<T>
: T extends ReadonlyArray<infer U>

@@ -114,0 +124,0 @@ ? Array<U extends NotJsonable ? null : Jsonify<U>>

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc