chore: prefer using @internal annotation over other markups (#37816)

This commit is contained in:
Zheeeng 2022-09-30 14:26:41 +08:00 committed by GitHub
parent f5a5077d80
commit 49206a53c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 18 additions and 12 deletions

View File

@ -2,6 +2,7 @@ import * as React from 'react';
import { ConfigContext } from '../config-provider';
interface BreadcrumbSeparatorInterface extends React.FC<{ children?: React.ReactNode }> {
/** @internal */
__ANT_BREADCRUMB_SEPARATOR: boolean;
}

View File

@ -134,6 +134,7 @@ export type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>;
interface CompoundedComponent
extends React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>> {
Group: typeof Group;
/** @internal */
__ANT_BUTTON: boolean;
}

View File

@ -9,6 +9,7 @@ export { CheckboxGroupProps, CheckboxOptionType } from './Group';
interface CompoundedComponent
extends React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>> {
Group: typeof Group;
/** @internal */
__ANT_CHECKBOX: boolean;
}

View File

@ -28,6 +28,7 @@ export interface DropdownButtonProps extends ButtonGroupProps, DropdownProps {
}
interface DropdownButtonInterface extends React.FC<DropdownButtonProps> {
/** @internal */
__ANT_BUTTON: boolean;
}

View File

@ -13,7 +13,7 @@ interface FormItemInputMiscProps {
warnings: React.ReactNode[];
marginBottom?: number | null;
onErrorVisibleChanged?: (visible: boolean) => void;
/** @private Internal Usage, do not use in any of your production. */
/** @internal do not use in any of your production. */
_internalItemRender?: {
mark: string;
render: (

View File

@ -7,7 +7,7 @@ import { getFieldId, toArray } from '../util';
export interface FormInstance<Values = any> extends RcFormInstance<Values> {
scrollToField: (name: NamePath, options?: ScrollOptions) => void;
/** This is an internal usage. Do not use in your prod */
/** @internal: This is an internal usage. Do not use in your prod */
__INTERNAL__: {
/** No! Do not use this in your code! */
name?: string;

View File

@ -9,7 +9,7 @@ export interface MenuContextProps {
antdMenuTheme?: MenuTheme;
direction?: DirectionType;
firstLevel: boolean;
/** @private Internal Usage. Safe to remove */
/** @internal Safe to remove */
disableMenuItemTitleTooltip?: boolean;
}

View File

@ -11,10 +11,10 @@ export interface OverrideContextProps {
onClick?: () => void;
}
/** @private Internal Usage. Only used for Dropdown component. Do not use this in your production. */
/** @internal Only used for Dropdown component. Do not use this in your production. */
const OverrideContext = React.createContext<OverrideContextProps | null>(null);
/** @private Internal Usage. Only used for Dropdown component. Do not use this in your production. */
/** @internal Only used for Dropdown component. Do not use this in your production. */
export const OverrideProvider = ({
children,
...restProps

View File

@ -30,9 +30,8 @@ export interface MenuProps extends Omit<RcMenuProps, 'items'> {
theme?: MenuTheme;
inlineIndent?: number;
// >>>>> Private
/**
* @private Internal Usage. Not promise crash if used in production. Connect with chenshuai2144
* @internal Not promise crash if used in production. Connect with chenshuai2144
* for removing.
*/
_internalDisableMenuItemTitleTooltip?: boolean;

View File

@ -271,7 +271,7 @@ export interface MessageApi extends MessageInstance {
useMessage(): [MessageInstance, React.ReactElement];
}
/** @private test Only function. Not work on production */
/** @internal test Only function. Not work on production */
export const getInstance = () => (process.env.NODE_ENV === 'test' ? messageInstance : null);
export default api as MessageApi;

View File

@ -338,7 +338,7 @@ export interface NotificationApi extends NotificationInstance {
useNotification: () => [NotificationInstance, React.ReactElement];
}
/** @private test Only function. Not work on production */
/** @internal test Only function. Not work on production */
export const getInstance = async (cacheKey: string) =>
process.env.NODE_ENV === 'test' ? notificationInstance[cacheKey] : null;

View File

@ -9,7 +9,7 @@ import { getTransitionName } from '../_util/motion';
export interface PopoverProps extends AbstractTooltipProps {
title?: React.ReactNode | RenderFunction;
content?: React.ReactNode | RenderFunction;
/** @private Used For Popconfirm. Safe to remove. */
/** @internal Used For Popconfirm. Safe to remove. */
_overlay?: React.ReactNode;
}

View File

@ -18,6 +18,7 @@ interface CompoundedComponent
extends React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLElement>> {
Group: typeof Group;
Button: typeof Button;
/** @internal */
__ANT_RADIO: boolean;
}

View File

@ -37,6 +37,7 @@ export interface SwitchProps {
interface CompoundedComponent
extends React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLElement>> {
/** @internal */
__ANT_SWITCH: boolean;
}

View File

@ -106,7 +106,7 @@ function getNode(dom: React.ReactNode, defaultNode: React.ReactNode, needDom?: b
return dom || (needDom && defaultNode);
}
function toList<T>(val: T | T[]): T[] {
function toList<T extends any>(val: T | T[]): T[] {
if (val === false) {
return [false, false] as T[];
}

View File

@ -18,7 +18,8 @@
"noImplicitAny": true,
"target": "es6",
"lib": ["dom", "es2017"],
"skipLibCheck": true
"skipLibCheck": true,
"stripInternal": true
},
"exclude": ["node_modules", "lib", "es"]
}