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

type-fest

Package Overview
Dependencies
Maintainers
1
Versions
155
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 2.15.1 to 2.16.0

source/has-optional-keys.d.ts

6

index.d.ts

@@ -41,3 +41,3 @@ // Basic

export {Asyncify} from './source/asyncify';
export {Simplify} from './source/simplify';
export {Simplify, SimplifyOptions} from './source/simplify';
export {Jsonify} from './source/jsonify';

@@ -61,2 +61,6 @@ export {Schema} from './source/schema';

export {ReadonlyTuple} from './source/readonly-tuple';
export {OptionalKeysOf} from './source/optional-keys-of';
export {HasOptionalKeys} from './source/has-optional-keys';
export {RequiredKeysOf} from './source/required-keys-of';
export {HasRequiredKeys} from './source/has-required-keys';

@@ -63,0 +67,0 @@ // Template literal types

2

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

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

@@ -195,2 +195,6 @@ <div align="center">

- [`Exact`](source/exact.d.ts) - Create a type that does not allow extra properties.
- [`OptionalKeysOf`](source/optional-keys-of.d.ts) - Extract all optional keys from the given type.
- [`HasOptionalKeys`](source/has-optional-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any optional fields.
- [`RequiredKeysOf`](source/required-keys-of.d.ts) - Extract all required keys from the given type.
- [`HasRequiredKeys`](source/has-required-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any required fields.

@@ -197,0 +201,0 @@ ### JSON

@@ -18,6 +18,6 @@ import type {IsEqual} from './internal';

export type Includes<Value extends readonly any[], Item> =
IsEqual<Value[0], Item> extends true
? true
: Value extends [Value[0], ...infer rest]
? Includes<rest, Item>
: false;
Value extends readonly [Value[0], ...infer rest]
? IsEqual<Value[0], Item> extends true
? true
: Includes<rest, Item>
: false;

@@ -65,4 +65,4 @@ type ReplaceOptions = {

? Options['all'] extends true
? Replace<`${Head}${Replacement}${Tail}`, Search, Replacement, Options>
? `${Head}${Replacement}${Replace<Tail, Search, Replacement, Options>}`
: `${Head}${Replacement}${Tail}`
: Input;
/**
@see Simplify
*/
export interface SimplifyOptions {
/**
Do the simplification recursively.
@default false
*/
deep?: boolean;
}
// Flatten a type without worrying about the result.
type Flatten<
AnyType,
Options extends SimplifyOptions = {},
> = Options['deep'] extends true
? {[KeyType in keyof AnyType]: Simplify<AnyType[KeyType], Options>}
: {[KeyType in keyof AnyType]: AnyType[KeyType]};
/**
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.

@@ -58,2 +78,7 @@

*/
export type Simplify<T> = {[KeyType in keyof T]: T[KeyType]};
export type Simplify<
AnyType,
Options extends SimplifyOptions = {},
> = Flatten<AnyType> extends AnyType
? Flatten<AnyType, Options>
: AnyType;
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