type-fest 2.12.0 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-fest",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "A collection of essential TypeScript types",
5
5
  "license": "(MIT OR CC0-1.0)",
6
6
  "repository": "sindresorhus/type-fest",
package/readme.md CHANGED
@@ -185,7 +185,7 @@ Click the type names for complete docs.
185
185
 
186
186
  ### Miscellaneous
187
187
 
188
- - [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
188
+ - [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). It also includes support for [TypeScript Declaration Files](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) and [Yarn Workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/).
189
189
  - [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 4.4).
190
190
 
191
191
  ## Declined types
@@ -199,6 +199,7 @@ Click the type names for complete docs.
199
199
  - [`Nullish`](https://github.com/sindresorhus/type-fest/pull/318) - The type only saves a couple of characters, not everyone knows what "nullish" means, and I'm also trying to [get away from `null`](https://github.com/sindresorhus/meta/discussions/7).
200
200
  - [`TitleCase`](https://github.com/sindresorhus/type-fest/pull/303) - It's not solving a common need and is a better fit for a separate package.
201
201
  - [`ExtendOr` and `ExtendAnd`](https://github.com/sindresorhus/type-fest/pull/247) - The benefits don't outweigh having to learn what they mean.
202
+ - [`PackageJsonExtras`](https://github.com/sindresorhus/type-fest/issues/371) - There are too many possible configurations that can be put into `package.json`. If you would like to extend `PackageJson` to support an additional configuration in your project, please see the *Extending existing types* section below.
202
203
 
203
204
  ## Alternative type names
204
205
 
@@ -209,9 +210,28 @@ Click the type names for complete docs.
209
210
 
210
211
  ## Tips
211
212
 
213
+ ### Extending existing types
214
+
215
+ - [`PackageJson`](source/package-json.d.ts) - There are a lot of tools that place extra configurations inside the `package.json` file. You can extend `PackageJson` to support these additional configurations.
216
+ <details>
217
+ <summary>
218
+ Example
219
+ </summary>
220
+
221
+ [Playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBDAnmApnA3gBQIYGMDW2A5igFIDOEAdnNuXAEJ0o4HFmVUC+cAZlBBBwA5ElQBaXinIxhAbgCwAKFCRYCZGnQAZYFRgooPfoJHSANntmKlysWlaESFanAC8jZo-YuaAMgwLKwBhal5gIgB+AC44XX1DADpQqnCiLhsgA)
222
+
223
+ ```ts
224
+ import type {PackageJson as BasePackageJson} from 'type-fest';
225
+ import type {Linter} from 'eslint';
226
+
227
+ type PackageJson = BasePackageJson & {eslintConfig?: Linter.Config};
228
+ ```
229
+ </details>
230
+
212
231
  ### Related
213
232
 
214
233
  - [typed-query-selector](https://github.com/g-plane/typed-query-selector) - Enhances `document.querySelector` and `document.querySelectorAll` with a template literal type that matches element types returned from an HTML element query selector.
234
+ - [`Linter.Config`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/eslint/index.d.ts) - Definitions for the [ESLint configuration schema](https://eslint.org/docs/user-guide/configuring/language-options).
215
235
 
216
236
  ### Built-in types
217
237
 
@@ -227,6 +227,7 @@ declare namespace PackageJson {
227
227
  Entry points of a module, optionally with conditions and subpath exports.
228
228
  */
229
229
  export type Exports =
230
+ | null
230
231
  | string
231
232
  | string[]
232
233
  | {[key in ExportCondition]: Exports}