Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api-extractor]: produces invalid dts if @internal identifiers are part of public API typings chain #3445

Open
Hotell opened this issue Jun 3, 2022 · 0 comments

Comments

@Hotell
Copy link

Hotell commented Jun 3, 2022

Summary

when publicTrimmedFilePath is used and public API surfaces contain type information that are produced from types that contain @internal annotation , api-extractor generates invalid .d.ts rollup file.

Repro steps

Link to whole repro

Steps:

  1. uncomment lines below this comment // uncomment next line - https://github.com/microsoft/rushstack/issues/3445 within packages/one/src/index.ts
  2. run yarn build
  3. check output in packages/one/dist/untrimmed.ts and packages/one/dist/public.ts

Actual result:

image

Expected result:

one of:

  1. inline @internal types to existing definition:
-export declare type WeekDay = WorkDay | WeekendDay;
+export declare type WeekDay = 'monday' | 'tuesday| ' saturday' | 'sunday';

export interface Baseball {
  foo: Hello;
- bar: WorkDay;
+ bar:  'monday' | 'tuesday| ' saturday' | 'sunday';
}
  1. remove parts of public API's that contain @internal

NOTE: This feels rather wrong so I dont think this is right approach

-export declare type WeekDay = WorkDay | WeekendDay;

export interface Baseball {
  foo: Hello;
- bar: WorkDay;
}
  1. throw error to notify user that he is doing something wrong - exposing public API's that contain @internal types within public API surface

both previous solutions (1 or 2) might be non trivial to implement, so at least providing correct guidance would provide good enough DX

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.24.2
Operating system? Linux/Mac
API Extractor scenario? rollups (.d.ts)
Would you consider contributing a PR? Maybe
TypeScript compiler version? 4.6.4
Node.js version (node -v)? 14.8.1
@github-project-automation github-project-automation bot moved this to Needs triage in Bug Triage Feb 26, 2024
@iclanton iclanton moved this from Needs triage to AE/AD in Bug Triage Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: AE/AD
Development

No branches or pull requests

1 participant