greymass / anchor-link

Persistent, fast and secure signature provider for EOSIO chains built on top of EOSIO Signing Requests (EEP-7)
Other
53 stars 22 forks source link

build error in angular #11

Closed tinyhill666 closed 3 years ago

tinyhill666 commented 4 years ago

ERROR in node_modules/anchor-link/lib/link-options.d.ts(37,19): error TS2304: Cannot find name 'TextEncoder'. node_modules/anchor-link/lib/link-options.d.ts(41,19): error TS2304: Cannot find name 'TextDecoder'. node_modules/anchor-link/lib/link-session.d.ts(85,21): error TS1039: Initializers are not allowed in ambient contexts. node_modules/anchor-link/lib/link-session.d.ts(88,5): error TS2424: Class 'LinkSession' defines instance member function 'serialize', but extended class 'LinkChannelSession' defines it as instance member property. node_modules/anchor-link/lib/link-session.d.ts(121,21): error TS1039: Initializers are not allowed in ambient contexts. node_modules/anchor-link/lib/link-session.d.ts(127,5): error TS2424: Class 'LinkSession' defines instance member function 'serialize', but extended class 'LinkFallbackSession' defines it as instance member property. node_modules/eosio-signing-request/lib/signing-request.d.ts(242,73): error TS2304: Cannot find name 'TextEncoder'. node_modules/eosio-signing-request/lib/signing-request.d.ts(242,99): error TS2304: Cannot find name 'TextDecoder'.

jnordberg commented 4 years ago

https://greymass.github.io/anchor-link/interfaces/linkoptions.html#textdecoder

aaroncox commented 4 years ago

You'll need to specify an encoder and decoder if the version of Angular you're using doesn't define them by default.

// initialize the link
const link = new AnchorLink({
    textDecoder: new TextDecoder(),
    textEncoder: new TextEncoder(),
    transport
})

If those are undefined in the version of JS/TS you're using, you may need a polyfill.

https://github.com/anonyco/FastestSmallestTextEncoderDecoder

jnordberg commented 3 years ago

Closing as this relates to version 2.0 and no further details where given.