typescript - Using Javascript from Angular which is extending String -
pretty new both angular , javascript, not sure whether trivial 1 i'm not able google out.
i need use proprietary, legacy js lib doing bespoke xml based marshalling/unmarshalling/remoting. of value objects having methods toxml
, toobject
, , extends stock classes string
these methods well.
i'm trying work angular - imported source js files, , after eg.
declare var discrete; declare var string;
i'm able work methods ending calling eg. discrete.toxml()
not ones calls string.toxml()
- fails @ runtime typeerror: string.toxml not function
.
also tried
declare interface string { toxml() : any; }
but didn't help.
any idea work? thanks!
the string
string type constructor, guess need extend interface, this:
interface string { toxml() : any; }
not sure, may need define in string.d.ts
file. can try that:
declare global { interface string { toxml() : any; } }
Comments
Post a Comment