New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

types-package-json

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

types-package-json

A handful set of **package.json** types and interfaces to improve working with dynamically imported **package.json** files. **@types/package-json** became deprecated as **package.json** files imported by typescript come with it's own type definitions. Som

  • 0.0.1-0
  • npm
  • Socket score

Version published
Weekly downloads
6.6K
increased by2.73%
Maintainers
1
Weekly downloads
 
Created
Source

Description

A handful set of package.json types and interfaces to improve working with dynamically imported package.json files. @types/package-json became deprecated as package.json files imported by typescript come with it's own type definitions. Sometimes though, when you import files dynamically type becomes any and that's when this package becomes useful.

Based on npm package.json documentation: https://docs.npmjs.com/files/package.json

Usage

import { IPackageJson } from 'types-package-json';

const packageJsonPath = path.resolve(process.cwd(), `package.json`);
const packageJson: IPackageJson = await import(packageJsonPath);

Features

  • Zero overhead - contains only types and interfaces, no actual objects.
  • I prefixed - all interfaces are prefiexed with I to avoid misunderstanding interface with a class and decrease naming overlaps.
  • IPackageJson - full package.json interface, name and version is required
  • IPackageJsonAddress - optional email and url
  • IPackageJsonPerson - required name, optional email and url
  • IPackageJsonDependencyTypes - 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies' (bundledDependencies are not included in this type as they serve different purpose).

FAQs

Package last updated on 04 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc