Remove, Deprecate or Alias: Choosing How to Retire an API

Sooner or later a function, option or export in your package has to go. You have three broad choices: delete it in the next major, deprecate it and delete it later, or keep it forever as a thin alias for its replacement. Each can be the right answer. This comparison sets them side by side and suggests which suits which situation.

The three approaches

Remove outright. The API disappears in the next major release, documented in the changelog's Removed section. Simple for the maintainer, abrupt for users, and only acceptable when you are confident few people use it or the replacement is obvious.

Deprecate, then remove. The API keeps working but warns, the documentation marks it deprecated, and removal happens in a later major. In JavaScript the JSDoc @deprecated tag makes editors strike the name through; in Python, warnings.warn(..., DeprecationWarning) is the conventional signal, and Python 3.13 added the warnings.deprecated decorator that type checkers also understand.

Alias permanently. The old name becomes a one-line wrapper around the new one and is never removed. Users never break; the cost is a slightly larger surface and documentation that has to explain why two names exist.

/** @deprecated Use `parseConfig` instead. Will be removed in 5.0. */
export function readConfig(path) {
  warnOnce("readConfig is deprecated; use parseConfig");
  return parseConfig(path);
}

Side by side

Remove outrightDeprecate then removePermanent alias
User effort at upgradeHighest, all at onceSpread over time, guided by warningsNone
Maintainer effortLowestMedium: warnings, docs, tracking removalLow, but forever
Version bump neededMajorMinor for deprecation, major for removalMinor (adds the new name)
Risk of surprise breakageHighLow if warnings are visibleVery low
Surface area over timeShrinksShrinks, laterGrows
Works when behaviour changes, not just the nameYesYesNo; an alias only fits a pure rename

Verdict by use case

Whichever you pick

Write down the replacement in the same sentence as the retirement, give a version number for removal if there is one, and make sure the warning appears where the user will actually see it rather than only in the docs. Our long read on package deprecation policy covers setting a standard window, and deprecating a function in a library walks through the code.

Related pages