I am in the process of upgrading my javascript code to TypeScript and I am facing issue with the following javascript function.
var PreserveLinebreakInTextArea = function () {
$.valHooks.textarea = { get: function (elem) { return elem.value.replace(/\r?\n/g, "\r\n"); } };
}
I am using the above method for preserving the line break in text area control. When I use this method in typescript file, I got the following error,
Any suggestion to fix this issue is appreciated.
You can either write:
var PreserveLinebreakInTextArea = function () {
$['valHooks'].textarea = { get: function (elem) { return elem.value.replace(/\r?\n/g, "\r\n"); } };
}
to keep tsc
happy or you can extend JQueryStatic
interface like this
interface JQueryStatic {
valHooks: any;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With