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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -