892: fix: type export via `typesVersions` r=fryorcraken a=filoozom

## Problem

Importing anything from TypeScript in `js-waku/lib/` (`v0.25.0-rc.0`) does not work. It can't find the types despite the `exports.*.types` in `package.json`.

## Solution

This solution was inspired by `libp2p` ([example in ``@libp2p/interfaces`](https://github.com/libp2p/js-libp2p-interfaces/blob/master/packages/interfaces/package.json#L24-L39)),` and just adds `typesVersions` to `package.json`.

Documentation: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#folder-redirects-using-

## Notes

- See https://github.com/status-im/js-waku/issues/891#issuecomment-1217388556


Co-authored-by: Philippe Schommers <philippe@schommers.be>
This commit is contained in:
status-bors-ng[bot] 2022-08-19 04:52:27 +00:00 committed by GitHub
commit d7181da98b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -22,6 +22,13 @@
"import": "./dist/lib/peer_discovery_static_list.js"
}
},
"typesVersions": {
"*": {
"lib/*": [
"dist/lib/*"
]
}
},
"type": "module",
"repository": "https://github.com/status-im/js-waku",
"license": "MIT OR Apache-2.0",