question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export Typescript Client in npm package

See original GitHub issue

Is there a reason the Client is not exported in the types?

It would be great to not have to reference a static path like this:

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
crobinson42commented, Feb 10, 2022

@olexandr-mazepa it is a bad practice to import from a publish package from a static path. The reason this is a bad pattern is because the directory structure of a package is an implementation detail that should only be known to the publisher of the package, thus, it can change at any time. The published directory structure is not part of the public API of a package, that is why the main and types properties exist in the package.json, to point the resolution engine (common.js, esm, etc.) to the file that should be imported.

1reaction
olexandr-mazepacommented, Feb 23, 2022

I’ve just merged the PR and published a new version on npm. So that you can use version 5.0.0 to be able to use the new approach for importing types.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow export of Client, Server and Common modules ...
I have a project (lets call it FlatEarth) with client-only, server-only and common components. I would like to create a single npm package...
Read more >
Step by step: Building and publishing an NPM Typescript ...
Typescript will then also export type definitions together with the compiled javascript code so the package can be used with both Typescript and ......
Read more >
Build and publish an NPM Typescript package | Codementor
Typescript will then also export type definitions together with the compiled javascript code so the package can be used with both Typescript and ......
Read more >
Creating a TS-written NPM package for use in Node-JS or ...
We'll be writing a src/index.ts file importing all of our library, and use the Typescript compiler to generate a Javascript variant in dist/ ......
Read more >
How To Use Modules in TypeScript | DigitalOcean
In TypeScript, when targetting a module loader that supports overwriting the exported object, you can change the value of the exported object by ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found