ワンクリックで
deprecate-react-component
Take an existing React component and add a deprecated/new overload pattern to it
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Take an existing React component and add a deprecated/new overload pattern to it
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | deprecate-react-component |
| description | Take an existing React component and add a deprecated/new overload pattern to it |
| argument-hint | ["ComponentName"] |
Refactor the existing $ARGUMENTS component in packages/components/src/$ARGUMENTS/index.tsx
to support both a deprecated legacy signature and a new versioned signature using TypeScript
function overloads.
Use templates/deprecated-component.tsx as the reference pattern.
New{{ComponentName}}Props interfaceBelow the existing props interface, add:
export interface New{{ComponentName}}Props extends {{ComponentName}}Props {
new: true;
}
Legacy{{ComponentName}}Change const {{ComponentName}} = ... to function Legacy{{ComponentName}}(props: {{ComponentName}}Props): React.JSX.Element.
Keep the body unchanged.
New{{ComponentName}} private functionCopy the Legacy{{ComponentName}} body as the starting point for the new implementation.
Place it directly below Legacy{{ComponentName}}.
{{ComponentName}} functionWrap the three declarations in eslint-disable / eslint-enable no-redeclare comments.
Mark the first overload as @deprecated:
/* eslint-disable no-redeclare */
/** @deprecated Add "new" prop to {{ComponentName}} to get the updated version */
function {{ComponentName}}(props: {{ComponentName}}Props): React.JSX.Element;
function {{ComponentName}}(props: New{{ComponentName}}Props): React.JSX.Element;
function {{ComponentName}}(props: {{ComponentName}}Props | New{{ComponentName}}Props): React.JSX.Element {
if ('new' in props) {
return New{{ComponentName}}(props);
}
return Legacy{{ComponentName}}(props);
}
/* eslint-enable no-redeclare */
export default {{ComponentName}} unchanged{{ComponentName}}Props itself as @deprecated — the deprecation lives only on the overload signature. Marking the interface would cause noise wherever the type is referenced (e.g. inside New{{ComponentName}}Props extends {{ComponentName}}Props).eslint-disable no-redeclare block is required because the project uses ESLint's base no-redeclare rule, which does not understand TypeScript function overloads.new discriminant on New{{ComponentName}}Props is what TypeScript uses to narrow the union in the dispatch function — 'new' in props.