Skip to content

Missing types field in package.json #148

Closed

Description

@demurgos

The package.json files have a main field but are missing a types field, it prevents some editors (such as Jetbrains' Webstorm and Intellij) from picking the type declarations and providing autocompletion.

For example, for @actions/core, the package.json should look like this:

{
  "name": "@actions/core",
  "main": "lib/core.js",
  "types": "lib/core.d.ts"
  // ...
}

Activity

  1. demurgos commented on Sep 19, 2019

    @demurgos
    Author

    I found that the error was on my end, I was using the Typescript options allowSyntheticDefaultImports and esModuleInterop with default imports (instead of star imports) while the modules are marked as transpiled from Typescript. After switching to star imports, it works. It may still be a good thing to add the types field but it's less important.

  2. bryanmacfarlane commented on Sep 24, 2019

    @bryanmacfarlane
    Contributor

    In addition actions should have dev dependency on types:
    https://github.com/actions/javascript-action/blob/master/package.json#L26

    But yeah, looks like a good thing to set per docs:
    https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions