Let's say I would like to add this method onto String
:
String.prototype.frenchQuote = function() {
return '« ' + this + ' »';
}
TypeScript will complain that there is no frenchQuote
method on String
.
Online, many suggestions can be found to then declare it like so:
interface String {
frenchQuote(): string
}
However, TypeScript flags this interface
as unused, and still complains about the non-existent method.
Is there a new way to augment the signature of imported types or built-ins?
Using TypeScript version 3.7