Thursday, 30 August 2018

Is there a basic TS type for package.json

I am just looking for a basic TS type representing an imported package.json file. I am loading an unknown package.json file dynamically, so it's not part of my build. Something like this:

export interface DepMap {
  [key:string]: string
}

export interface PackageJSON {
  name: string,
  version: string,
  dependencies?: DepMap,
  devDependencies?:DepMap,
  optionalDependencies?: DepMap
}

does anyone maintain something like this on Github?

As an aside, here is the "official" json-schema for package.json: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/package.json



from Is there a basic TS type for package.json

No comments:

Post a Comment