nats-io / nats.ws

WebSocket NATS
Apache License 2.0
322 stars 27 forks source link

The documented CJS import doesn't work with typescript #133

Open henrify opened 2 years ago

henrify commented 2 years ago

Hi, the docs start with saying that CommonJS version is rooted at "./cjs/nats.js", however, that cannot be imported directly from TypeScript, as there are no typings.

For CommonJS + TypeScript, the only import I got to work was: import {connect, NatsConnection} from "nats.ws/lib/src/mod.js";

Is that the correct way?

Plus obviously it would be good to fix the basics -- use a more standard package layout that is easy and obvious to import, and document clearly how to import for modern stuff for those who still fail at the easy and obvious (currently the "importing the module" section of the docs only talks about using a Githubissues.

  • Githubissues is a development platform for aggregating issues.