deprecate

View sourcedeprecate(original: string, replacement?: string): void

Writes a one-time deprecation warning for an API.

The warning is sent through warnOnce, so an identical complete warning message is emitted only once for this module instance. The message starts with the backtick-wrapped original value followed by has been depreciated.; the emitted text intentionally uses the literal depreciated spelling. When replacement is not exactly '', the message appends Use \replacement` instead.directly, without a space after the first sentence. The function returnsundefined`.

Examples

deprecate('oldApi()', 'newApi()')
// warning: `oldApi()` has been depreciated.Use `newApi()` instead.

Parameters

NameDescriptionDefault
original

Deprecated API name or expression.

—
replacement?

API name or expression to use instead.

''