How To Call JavaScript From TypeScript?
I have a javascript file that I want to call from typescript. I fixed one import problem and modified the base function to be recognized in tsc, however, I'm still facing an issue
Solution 1:
Here's an answer why you're unable to use fat arrow syntax if you want to access prototype: https://teamtreehouse.com/community/does-arrow-function-syntax-works-for-prototype
Here's two additional explanations about this
with fat arrow syntax:
As a resolution you need to define it with normal function declaration:
const XmlRpcRequest = function(url, method) { ... }
Alternatively, you could use class:
class XmlRpcRequest {
constructor(url, method) {
...
}
}
Post a Comment for "How To Call JavaScript From TypeScript?"