package.json to TypeScript

Paste any package.json (yours, or one you need to read programmatically) and get a TypeScript interface for name, exports, scripts, dependencies, and the rest.

JSON input valid
TypeScript output

      
    

About this conversion

package.json is the manifest every JavaScript and TypeScript package ships with, but the shape is poorly documented and the npm spec keeps growing — engines, exports map (with import / require / types branches), workspaces, packageManager, type="module", publishConfig, repository (string or object), bugs (string or object), and so on. Hand-typing this is error-prone, especially the conditional exports tree where each entry can be a string OR a nested object with up to a dozen branches.

Pasting a real package.json — yours, or a target package's — generates a TypeScript interface tight enough to drop into a build script, a monorepo tool, a registry analyzer, or a CI step that lints manifests. Combined with the schema from json.schemastore.org/package, the generated types catch missing fields before they crash production tooling.

Same shape, other validators

Other JSON shapes