VDL Plugin SDK

getDeprecationMessage

Import from @varavel/vdl-plugin-sdk/utils/deprecations.

function getDeprecationMessage(annotations): string | undefined;

Returns the human-readable deprecation message, when one exists.

Only a string argument counts as the VPP-1 message. A missing argument or a non-string argument yields undefined while the symbol stays deprecated; use isDeprecated for presence.

Parameters

ParameterTypeDescription
annotationsAnnotation[] | undefinedAnnotation list from any annotated IR node.

Returns

string | undefined

The string message, or undefined when absent or non-string.

Example

getDeprecationMessage(field.annotations);
// returns "Use primaryEmail instead." for `@deprecated("Use primaryEmail instead.")`