Answer the question
In order to leave comments, you need to log in
How to extend class prototype in TS?
Need something like this (error - foo not found):
interface String {
foo(): number;
}
String.foo= function() {
return 0;
}
String.prototype.foo= function() {
return 0;
}
Answer the question
In order to leave comments, you need to log in
declare global {
interface String {
foo(): number;
}
}
String.prototype.foo = function () {
return 0;
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question