I know it's possible to annotate entire properties as deprecated, but is it possible to annotated one (or more) single values within a string union as deprecated?
For example, given this type declaration:
export type BoxProps = HTMLAttributes<HTMLDivElement> & {
/**
* @deprecated rounded has no effect and will be removed in a future version
*/
rounded?: boolean;
variant?:
| 'neutral'
| 'grey'
| 'success'
| 'warning';
thickBorder?: boolean;
};
...my IDE (VS Code) will warn me that the rounded param is deprecated and will show it as visually "crossed out".
But If I try to annotate one single value of the variant string literal union type, my IDE will suggest all possible options with no warnings or visual treatments indicating that any string is deprecated:
TypeScript
export type BoxProps = HTMLAttributes<HTMLDivElement> & {
/**
* @deprecated rounded has no effect and will be removed in a future version
*/
rounded?: boolean;
variant?:
| 'neutral'
/** @deprecated */
| 'grey'
| 'success'
| 'warning';
thickBorder?: boolean;
// or
TypeScript
export type BoxProps = HTMLAttributes<HTMLDivElement> & {
/**
* @deprecated rounded has no effect and will be removed in a future version
*/
rounded?: boolean;
variant?:
| 'neutral'
| 'grey' /** @deprecated */
| 'success'
| 'warning';
thickBorder?: boolean;
};
// or
TypeScript
export type BoxProps = HTMLAttributes<HTMLDivElement> & {
/**
* @deprecated rounded has no effect and will be removed in a future version
*/
rounded?: boolean;
variant?:
| 'neutral'
| /** @deprecated */ 'grey'
| 'success'
| 'warning';
thickBorder?: boolean;
};
Is this just not possible? Or is there some other syntax that needs to be used to annotate single strings as deprecated? (Or am I missing a VS Code plugin?)