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'; import { ConfigContext } from '../config-provider';
interface BreadcrumbSeparatorInterface extends React.FC<{ children?: React.ReactNode }> { interface BreadcrumbSeparatorInterface extends React.FC<{ children?: React.ReactNode }> {
/** @internal */
__ANT_BREADCRUMB_SEPARATOR: boolean; __ANT_BREADCRUMB_SEPARATOR: boolean;
} }

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ interface FormItemInputMiscProps {
warnings: React.ReactNode[]; warnings: React.ReactNode[];
marginBottom?: number | null; marginBottom?: number | null;
onErrorVisibleChanged?: (visible: boolean) => void; 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?: { _internalItemRender?: {
mark: string; mark: string;
render: ( render: (

View File

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

View File

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

View File

@ -11,10 +11,10 @@ export interface OverrideContextProps {
onClick?: () => void; 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); 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 = ({ export const OverrideProvider = ({
children, children,
...restProps ...restProps

View File

@ -30,9 +30,8 @@ export interface MenuProps extends Omit<RcMenuProps, 'items'> {
theme?: MenuTheme; theme?: MenuTheme;
inlineIndent?: number; 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. * for removing.
*/ */
_internalDisableMenuItemTitleTooltip?: boolean; _internalDisableMenuItemTitleTooltip?: boolean;

View File

@ -271,7 +271,7 @@ export interface MessageApi extends MessageInstance {
useMessage(): [MessageInstance, React.ReactElement]; 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 const getInstance = () => (process.env.NODE_ENV === 'test' ? messageInstance : null);
export default api as MessageApi; export default api as MessageApi;

View File

@ -338,7 +338,7 @@ export interface NotificationApi extends NotificationInstance {
useNotification: () => [NotificationInstance, React.ReactElement]; 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) => export const getInstance = async (cacheKey: string) =>
process.env.NODE_ENV === 'test' ? notificationInstance[cacheKey] : null; process.env.NODE_ENV === 'test' ? notificationInstance[cacheKey] : null;

View File

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

View File

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

View File

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

View File

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

View File

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