Skip to content

Commit

Permalink
chore: prefer using @internal annotation over other markups (ant-desi…
Browse files Browse the repository at this point in the history
  • Loading branch information
zheeeng authored Sep 30, 2022
1 parent f5a5077 commit 49206a5
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions components/breadcrumb/BreadcrumbSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions components/checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions components/dropdown/dropdown-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface DropdownButtonProps extends ButtonGroupProps, DropdownProps {
}

interface DropdownButtonInterface extends React.FC<DropdownButtonProps> {
/** @internal */
__ANT_BUTTON: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion components/form/FormItemInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand Down
2 changes: 1 addition & 1 deletion components/form/hooks/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/menu/MenuContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions components/menu/OverrideContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions components/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/message/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion components/notification/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion components/popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions components/radio/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ interface CompoundedComponent
extends React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLElement>> {
Group: typeof Group;
Button: typeof Button;
/** @internal */
__ANT_RADIO: boolean;
}

Expand Down
1 change: 1 addition & 0 deletions components/switch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface SwitchProps {

interface CompoundedComponent
extends React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLElement>> {
/** @internal */
__ANT_SWITCH: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion components/typography/Base/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
}
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"noImplicitAny": true,
"target": "es6",
"lib": ["dom", "es2017"],
"skipLibCheck": true
"skipLibCheck": true,
"stripInternal": true
},
"exclude": ["node_modules", "lib", "es"]
}

0 comments on commit 49206a5

Please sign in to comment.