# types-pkg-json

> Type checking for package.json

Latest version **2.0.0** (published 2026-03-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install types-pkg-json
pnpm add types-pkg-json
yarn add types-pkg-json
bun add types-pkg-json
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-03-11 |
| First published | 2020-09-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^24.0.0 \|\| ^26.0.0 |
| Dependencies | 2 |
| Unpacked size | 31.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 2 |
| Author | Connor White |
| Maintainers | bconnorwhite |
| Keywords | type, types, package, json, fields, typescript, ts, object, file |

## Links

- npm: https://www.npmjs.com/package/types-pkg-json
- Repository: https://github.com/bconnorwhite/types-pkg-json
- Homepage: https://github.bconnorwhite.com/types-pkg-json#readme
- Issues: https://github.com/bconnorwhite/types-pkg-json/issues
- npm.io page: https://npm.io/package/types-pkg-json

## Dependencies (2)

- [types-json](https://npm.io/package/types-json.md) ^5.0.0
- [types-eslintrc](https://npm.io/package/types-eslintrc.md) ^3.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2026-03-11
- 1.2.1 — 2020-10-09
- 1.1.2 — 2020-09-19
- 1.1.1 — 2020-09-19
- 1.1.0 — 2020-09-09
- 1.0.2 — 2020-09-08
- 1.0.1 — 2020-09-08
- 1.0.0 — 2020-09-08

## README

<div align="center">
  <h1>types-pkg-json</h1>
  <a href="https://npmjs.com/package/types-pkg-json">
    <img alt="NPM" src="https://img.shields.io/npm/v/types-pkg-json.svg">
  </a>
  <a href="https://github.com/bconnorwhite/types-pkg-json">
    <img alt="TypeScript" src="https://img.shields.io/github/languages/top/bconnorwhite/types-pkg-json.svg">
  </a>
  <a href='https://coveralls.io/github/bconnorwhite/types-pkg-json?branch=main'>
    <img alt="Coverage Status" src="https://img.shields.io/coveralls/github/bconnorwhite/types-pkg-json.svg?branch=main">
  </a>
</div>

<br />

> Type checking for package.json.

Derived from [type-fest](https://www.npmjs.com/package/type-fest) with a focus on package.json types.

## Installation

<details open>
  <summary>
    <a href="https://www.npmjs.com/package/types-pkg-json">
      <img src="https://img.shields.io/badge/npm-CB3837?logo=npm&logoColor=white" alt="NPM" />
    </a>
  </summary>

```sh
npm install types-pkg-json
```

</details>

<details>
  <summary>
    <a href="https://yarnpkg.com/package/types-pkg-json">
      <img src="https://img.shields.io/badge/yarn-2C8EBB?logo=yarn&logoColor=white" alt="Yarn" />
    </a>
  </summary>

```sh
yarn add types-pkg-json
```

</details>

<details>
  <summary>
    <img src="https://img.shields.io/badge/pnpm-F69220?logo=pnpm&logoColor=white" alt="PNPM" />
  </summary>

```sh
pnpm add types-pkg-json
```

</details>

<details>
  <summary>
    <img src="https://img.shields.io/badge/bun-EE81C3?logo=bun&logoColor=white" alt="Bun" />
  </summary>

```sh
bun add types-pkg-json
```

</details>


## API

### Types

```ts
import { PackageJSON, fileName, PackageJSONFileName } from "types-pkg-json"; // Type for NPM's package.json file

console.log(fileName); // "package.json"
```

#### Field Types

```ts
import {
  BugsLocation, // Used by the `bugs` field.
  LicenseID, // Used by the `license` and `licenses.type` fields.
  Person, // Used by the `author`, `contributors`, and `maintainers` fields.
  DirectoryLocations, // Used by the `directories` field.
  Repository, // Used by the `repository` field.
  Scripts, // Used by the `scripts` field.
  Dependencies // Used by the `dependencies`, `devDependencies`, `optionalDependencies`, and `peerDependencies` fields.
} from "types-pkg-json";
```

#### Configuration Types

```ts
import {
  NonStandardEntryPoints, // module, esnext, browser, sideEffects
  TypeScriptConfiguration, // types, typings
  WorkspaceConfig, // packages, nohoist
  YarnConfiguration, // workspaces, flat, resolutions
  JSPMConfiguration, // jspm
  ESLintConfiguration // eslintConfig
} from "types-pkg-json";
```

#### Utility Types

```ts
import {
  isJSONObject
  JSONObject,
  JSONValue,
  JSONArray,
  Primitive,
  LiteralUnion
} from "types-pkg-json";

function isJSONObject(object?: JSONValue): object is JSONObject;
```

<br />

<h2>Dependencies<img align="right" alt="dependencies" src="https://img.shields.io/david/bconnorwhite/types-pkg-json.svg"></h2>

- [types-json](https://www.npmjs.com/package/types-json): Type checking for JSON objects
- [types-eslintrc](https://www.npmjs.com/package/types-eslintrc): Type checking for .eslintrc.json

<br />


<!--BEGIN FOOTER-->
<h2 id="license">License <a href="https://opensource.org/licenses/MIT"><img align="right" alt="license" src="https://img.shields.io/npm/l/types-pkg-json.svg"></a></h2>

[MIT](https://opensource.org/licenses/MIT) - _MIT License_
<!--END FOOTER-->

---
_Source: https://npm.io/package/types-pkg-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
