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.6.1 to 3.7.0

source/is-literal.d.ts

8

index.d.ts

@@ -10,2 +10,3 @@ // Basic

export type {Except} from './source/except';
export type {TaggedUnion} from './source/tagged-union';
export type {Writable} from './source/writable';

@@ -80,2 +81,9 @@ export type {WritableDeep} from './source/writable-deep';

export type {IsEqual} from './source/is-equal';
export type {
IsLiteral,
IsStringLiteral,
IsNumericLiteral,
IsBooleanLiteral,
IsSymbolLiteral,
} from './source/is-literal';

@@ -82,0 +90,0 @@ // Template literal types

11

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

@@ -39,4 +39,4 @@ "license": "(MIT OR CC0-1.0)",

"expect-type": "^0.15.0",
"tsd": "^0.24.1",
"typescript": "^4.9.3",
"tsd": "^0.28.0",
"typescript": "^5.0.2",
"xo": "^0.53.1"

@@ -53,3 +53,8 @@ },

}
},
"tsd": {
"compilerOptions": {
"noUnusedLocals": false
}
}
}

@@ -123,2 +123,4 @@ <div align="center">

- [`Constructor`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
- [`AbstractClass`](source/basic.d.ts) - Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).
- [`AbstractConstructor`](source/basic.d.ts) - Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.
- [`TypedArray`](source/typed-array.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.

@@ -175,2 +177,8 @@ - [`ObservableLike`](source/observable-like.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).

- [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal.
- [`IsLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
- [`IsStringLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
- [`IsNumericLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
- [`IsBooleanLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
- [`IsSymbolLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
- [`TaggedUnion`](source/tagged-union.d.ts) - Create a union of types that share a common discriminant property.

@@ -177,0 +185,0 @@ ### JSON

@@ -16,2 +16,16 @@ /**

/**
Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/classes.html#abstract-classes).
@category Class
*/
export type AbstractClass<T, Arguments extends unknown[] = any[]> = AbstractConstructor<T, Arguments> & {prototype: T};
/**
Matches an [`abstract class`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-2.html#abstract-construct-signatures) constructor.
@category Class
*/
export type AbstractConstructor<T, Arguments extends unknown[] = any[]> = abstract new(...arguments_: Arguments) => T;
/**
Matches a JSON object.

@@ -18,0 +32,0 @@

@@ -32,5 +32,18 @@ import type {IsEqual} from './is-equal';

type ExceptOptions = {
/**
Disallow assigning non-specified properties.
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
@default false
*/
requireExactProps?: boolean;
};
/**
Create a type from an object type without certain keys.
We recommend setting the `requireExactProps` option to `true`.
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.

@@ -47,7 +60,15 @@

b: string;
c: boolean;
};
type FooWithoutA = Except<Foo, 'a' | 'c'>;
//=> {b: string};
type FooWithoutA = Except<Foo, 'a'>;
//=> {b: string}
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
//=> errors: 'a' does not exist in type '{ b: string; }'
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
//=> {a: number} & Partial<Record<"b", never>>
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
```

@@ -57,4 +78,6 @@

*/
export type Except<ObjectType, KeysType extends keyof ObjectType> = {
export type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
};
} & (Options['requireExactProps'] extends true
? Partial<Record<KeysType, never>>
: {});

@@ -260,1 +260,6 @@ import type {Primitive} from './primitive';

: false;
/**
Returns a boolean for whether the given `boolean` is not `false`.
*/
export type IsNotFalse<T extends boolean> = [T] extends [false] ? false : true;

@@ -228,9 +228,13 @@ declare namespace TsConfigJson {

| 'node'
| 'node10'
| 'node16'
| 'nodenext'
| 'bundler'
// Pascal-cased alternatives
| 'Classic'
| 'Node'
| 'Node10'
| 'Node16'
| 'NodeNext';
| 'NodeNext'
| 'Bundler';

@@ -241,2 +245,4 @@ export type ModuleDetection =

| 'force';
export type IgnoreDeprecations = '5.0';
}

@@ -249,2 +255,3 @@

@default 'utf8'
@deprecated This option will be removed in TypeScript 5.5.
*/

@@ -408,3 +415,3 @@ charset?: string;

Default: Platform specific
@default 'LF'
*/

@@ -480,2 +487,3 @@ newLine?: CompilerOptions.NewLine;

@default false
@deprecated This option will be removed in TypeScript 5.5.
*/

@@ -571,2 +579,3 @@ noStrictGenericChecks?: boolean;

@default false
@deprecated This option will be removed in TypeScript 5.5.
*/

@@ -579,2 +588,3 @@ suppressExcessPropertyErrors?: boolean;

@default false
@deprecated This option will be removed in TypeScript 5.5.
*/

@@ -692,3 +702,3 @@ suppressImplicitAnyIndexErrors?: boolean;

@default false
@default true
*/

@@ -766,2 +776,3 @@ forceConsistentCasingInFileNames?: boolean;

@default false
@deprecated This option will be removed in TypeScript 5.5.
*/

@@ -814,2 +825,3 @@ noImplicitUseStrict?: boolean;

@default 'remove'
@deprecated Use `verbatimModuleSyntax` instead.
*/

@@ -885,2 +897,3 @@ importsNotUsedAsValues?: CompilerOptions.ImportsNotUsedAsValues;

@default false
@deprecated This option will be removed in TypeScript 5.5.
*/

@@ -956,2 +969,3 @@ keyofStringsOnly?: boolean;

@default true
@deprecated Use `verbatimModuleSyntax` instead.
*/

@@ -971,2 +985,47 @@ preserveValueImports?: boolean;

moduleDetection?: CompilerOptions.ModuleDetection;
/**
Allows TypeScript files to import each other with a TypeScript-specific extension like .ts, .mts, or .tsx.
@default false
*/
allowImportingTsExtensions?: boolean;
/**
Forces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.
@default false
*/
resolvePackageJsonExports?: boolean;
/**
Forces TypeScript to consult the imports field of package.json files when performing a lookup that starts with # from a file whose ancestor directory contains a package.json.
@default false
*/
resolvePackageJsonImports?: boolean;
/**
Suppress errors for file formats that TypeScript does not understand.
@default false
*/
allowArbitraryExtensions?: boolean;
/**
List of additional conditions that should succeed when TypeScript resolves from package.json.
*/
customConditions?: string[];
/**
Anything that uses the type modifier is dropped entirely.
@default false
*/
verbatimModuleSyntax?: boolean;
/**
Suppress deprecation warnings
*/
ignoreDeprecations?: CompilerOptions.IgnoreDeprecations;
};

@@ -1068,2 +1127,3 @@

Only valid for `--outFile` compilations.
@deprecated This option will be removed in TypeScript 5.5.
*/

@@ -1108,3 +1168,3 @@ prepend?: boolean;

*/
extends?: string;
extends?: string | string[];

@@ -1111,0 +1171,0 @@ /**

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