TypeScript: Poor deprecated messages - types should almost never be displayed.

/** @deprecated - this is bad advice */
declare function crossTheStreams(): void

crossTheStreams()

Expected: 'crossTheStreams' is deprecated. Actual: '(): void' is deprecated

Notice the type in place of the entity name, notice the lack of a period at the end.

image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I see I had the wrong idea of what valueDeclaration was. It’s conditionally set. image

This should normally happen only with overloads.

Only if not every overload is deprecated. If all overloads are deprecated, showing the type doesn’t help.

I assume this isn’t as simple as using signature.declaration.name.escapedText?

It is better to use one of the various helpers for printing out the expression when a name is available. We’ve done this in a couple of places where we try to special case this when the invoked expression is an identifier/property access.

First value declaration means first declaration of value

You can also find all declarations(includes valueDeclaration) in the declarations field

Note: This should normally happen only with overloads. It’s not great with overloads either, so probably the overload message should be '{0}' with type '{1}' is deprecated. instead of putting a type into '{0}' is deprecated