-
Notifications
You must be signed in to change notification settings - Fork 585
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] Support docs/trimming for members of a literal union type alias #4699
Comments
This feature request is closely related to #3002 which asks for documenting/trimming members of a In general, But in both cases, #4699 involves a /**
* The icon size.
* @public
*/
export type IconSize =
/**
* 16x16 pixels
*/
'small' |
/**
* 32x32 pixels
* @beta
*/
'medium'; #3002 involves a export type Book = {
/** The title */
title: string;
/** The description */
description: string;
}; Thus, these particular patterns should be relatively well-behaved and straightforward to incorporate into the API item model. We could try to automatically detect them, but I think this would give a confusing experience. A seemingly small modification such as Proposed designLet's call the above patterns formed types which means a In this proposal, the user must declare the form explicitly, using new TSDoc tags such as /**
* The icon size.
* @formedEnum
* @public
*/
export type IconSize =
/** 16x16 pixels */
'small' |
/** 32x32 pixels */
'medium';
/**
* @formedInterface
* @public
*/
export type Book = {
/** The title */
title: string;
/** The description */
description: string;
}; With these tags, API Extractor will validate that the Whereas if you omit the ImplementationThe This issue #4699 I think is the easier one to start with. We've already confirmed that the TypeScript compiler correctly propagates all the export type IconSize =
/** 16x16 pixels */
'small' |
/** 32x32 pixels */
'medium'; ...versus... export type IconSize =
/** 16x16 pixels */
'small'
/** 32x32 pixels */
| 'medium'; ...and what would we do with... export type IconSize =
/** 16x16 pixels */
'small'
/** A */
|
/** B */
'medium'; We also need to decide whether to reuse |
Summary
Release tags (
@alpha
,@beta
,@internal
,@public
) are great and allow having flexibility in API releases.One of the features we would benefit from is the ability to specify the release tags for union types members.
Details
For example, we may have an existing API like
We want to test a new
large
size asbeta
.So we would like to be able to do something like:
and allow API Extractor to create different definitions for public and beta releases.
This behavior can be "opt-in" only: for example, we may need to specify extra tsdoc tag to the type to process the type in a new way:
The same is applicable for union of interface:
Standard questions
Please answer these questions to help us investigate your issue more quickly:
@microsoft/api-extractor
version?node -v
)?The text was updated successfully, but these errors were encountered: