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.

Private types are exported

See original GitHub issue

Bug report This bundler exports private types. (“Private” as in “not exported”. This has nothing to do with private fields.)

This is a problem because this means that you can no longer split one complex type into many simpler types.

Input code

This is a very simple example. In reality, B is reused across different exported types but kept private because it doesn’t make sense on its own. Users of my library shouldn’t be able to refer to B, hence it is not exported.

export type A = string | B;
type B = number;

Expected output

// Generated by dts-bundle-generator v5.8.0

export declare type A = string | B;
declare type B = number;

export {};

Actual output

// Generated by dts-bundle-generator v5.8.0

export declare type A = string | B;
export declare type B = number;

export {};

Additional context CLI: npx dts-bundle-generator -o my.d.ts src/foo.ts

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
timocovcommented, Apr 13, 2021

The new version 5.9 has been published with the fix.

0reactions
RunDevelopmentcommented, Apr 13, 2021

I just tested it out and it worked beautifully as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

private type with exported fields - Stack Overflow
It seems to me, that in order to have access to one of the exported fields, you would have to be able to...
Read more >
Documentation - TypeScript 3.8
TypeScript 3.8 adds a new syntax for type-only imports and exports. ... TypeScript 3.8 brings support for ECMAScript's private fields, part of the...
Read more >
Return type of exported function has or is using private name ...
Return type of exported function has or is using private name 'PaginatedResponseClass'. Issue #670 · MichalLytek/type-graphql · GitHub.
Read more >
Public vs. private · YourBasic Go
Exported and unexported identifiers are used to describe the public interface of a package and to guard against certain programming errors.
Read more >
Export Clauses - Scala 3 - EPFL
An export clause defines aliases for selected members of an object. ... new Printer { type PrinterType = InkJet } private val scanUnit...
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