Aaronius / penpal

A promise-based library for securely communicating with iframes via postMessage.
MIT License
389 stars 56 forks source link

TypeScript declaration files no longer found #24

Closed ahtcx closed 5 years ago

ahtcx commented 5 years ago

Since #23 TypeScript declarations are no longer found.

Could not find a declaration file for module 'penpal'. '[...]/node_modules/penpal/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/penpal` if it exists or add a new declaration (.d.ts) file containing `declare module 'penpal';` ts(7016)

When installed from npm only the ./dist and ./lib folders and downloaded, ./lib contains index.d.ts which is copied from ./types during the build script. The problem is that package.json sets types to ./types/index.d.ts which doesn't exist when installed from npm.

I would have submitted a PR but am unsure what to do since either ./types exists (when installed from npm) or ./lib exists (when cloning the git repository) so in one of the cases the package.json would be incorrect.

Simple fix would be to add ./types to the npm download.

@mike-north

Aaronius commented 5 years ago

I think the appropriate thing here is to change the reference in package.json to point to lib/index.d.ts. I've done so and published it in 3.0.7.