type-fest
Advanced tools
Comparing version 0.5.2 to 0.6.0
@@ -5,3 +5,3 @@ // Basic | ||
// Utilities | ||
export {Omit} from './source/omit'; | ||
export {Except} from './source/except'; | ||
export {Mutable} from './source/mutable'; | ||
@@ -13,4 +13,5 @@ export {Merge} from './source/merge'; | ||
export {LiteralUnion} from './source/literal-union'; | ||
export {Promisable} from './source/promisable'; | ||
// Miscellaneous | ||
export {PackageJson} from './source/package-json'; |
{ | ||
"name": "type-fest", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "A collection of essential TypeScript types", | ||
@@ -13,3 +13,3 @@ "license": "(MIT OR CC0-1.0)", | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=8" | ||
}, | ||
@@ -35,5 +35,6 @@ "scripts": { | ||
"devDependencies": { | ||
"@sindresorhus/tsconfig": "^0.3.0", | ||
"@typescript-eslint/eslint-plugin": "^1.8.0", | ||
"eslint-config-xo-typescript": "^0.11.0", | ||
"@sindresorhus/tsconfig": "^0.4.0", | ||
"@typescript-eslint/eslint-plugin": "^1.9.0", | ||
"@typescript-eslint/parser": "^1.10.2", | ||
"eslint-config-xo-typescript": "^0.14.0", | ||
"tsd": "^0.7.3", | ||
@@ -40,0 +41,0 @@ "xo": "^0.24.0" |
@@ -39,3 +39,3 @@ <div align="center"> | ||
```ts | ||
import {Omit} from 'type-fest'; | ||
import {Except} from 'type-fest'; | ||
@@ -47,3 +47,3 @@ type Foo = { | ||
type FooWithoutRainbow = Omit<Foo, 'rainbow'>; | ||
type FooWithoutRainbow = Except<Foo, 'rainbow'>; | ||
//=> {unicorn: string} | ||
@@ -69,3 +69,3 @@ ``` | ||
- [`Omit`](source/omit.d.ts) - Create a type from an object type without certain keys. | ||
- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). | ||
- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` properties into a mutable object. Inverse of `Readonly<T>`. | ||
@@ -77,2 +77,3 @@ - [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type. | ||
- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). | ||
- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`. | ||
@@ -79,0 +80,0 @@ ### Miscellaneous |
@@ -16,2 +16,3 @@ /// <reference lib="esnext"/> | ||
// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default | ||
/** | ||
@@ -40,2 +41,4 @@ Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). | ||
Matches a JSON object. | ||
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`. | ||
*/ | ||
@@ -42,0 +45,0 @@ export type JsonObject = {[key: string]: JsonValue}; |
@@ -1,2 +0,2 @@ | ||
import {Omit} from './omit'; | ||
import {Except} from './except'; | ||
@@ -22,2 +22,2 @@ /** | ||
*/ | ||
export type Merge<FirstType, SecondType> = Omit<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType; | ||
export type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType; |
@@ -255,2 +255,9 @@ import {LiteralUnion} from '..'; | ||
/** | ||
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command line, set this to `true`. | ||
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an application), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line. | ||
*/ | ||
flat?: boolean; | ||
/** | ||
Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file. | ||
@@ -257,0 +264,0 @@ */ |
@@ -1,2 +0,2 @@ | ||
import {Omit} from './omit'; | ||
import {Except} from './except'; | ||
@@ -32,2 +32,2 @@ /** | ||
// …then, make intersection types by adding the remaining properties to each mapped type. | ||
& Omit<ObjectType, KeysType>; | ||
& Except<ObjectType, KeysType>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29621
14
691
120
155
1
1
1
34
6