Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing types field in package.json #148

Closed
demurgos opened this issue Sep 19, 2019 · 2 comments
Closed

Missing types field in package.json #148

demurgos opened this issue Sep 19, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@demurgos
Copy link

demurgos commented Sep 19, 2019

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"
  // ...
}
@demurgos
Copy link
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.

@bryanmacfarlane
Copy link
Member

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

@bryanmacfarlane bryanmacfarlane self-assigned this Sep 24, 2019
@bryanmacfarlane bryanmacfarlane added the enhancement New feature or request label Nov 13, 2019
ericsciple pushed a commit that referenced this issue Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants