Home > Enterprise >  What does "types" field do in package.json?
What does "types" field do in package.json?

Time:08-12

{
  "files": [],
  "types": "./index.d.ts"
}

My understanding of "files" field is "including files in the array when the package is published to npm registry.

But I don't understand what "types" do here.

CodePudding user response:

From the typescript handbook:

Set the types property to point to your bundled declaration file.

This key points to the .d.ts file for the typings when you publish a typescript package.

  • Related