decentralized-identity / sidetree

Sidetree Specification and Reference Implementation
https://identity.foundation/sidetree/spec
Apache License 2.0
438 stars 112 forks source link

Compile error #819

Closed rockyhwang closed 1 year ago

rockyhwang commented 4 years ago

Hi I got following errors after run tsc index.ts command. I modify the "target" and "lib" attribute value in tsconfig.json to the newer es version. But, it does not work at all. Please advise what should I do further to conquer the problems. Thanks a lot!

bitcoin/BitcoinProcessor.ts:321:24 - error TS2569: Type 'IterableIterator' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.

321 for (const hash of hashes) {


bitcoin/RequestError.ts:13:14 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

13   public get status (): number {

bitcoin/RequestError.ts:18:14 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

18 public get expose (): boolean {


core/Blockchain.ts:142:14 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

142   public get approximateTime (): BlockchainTimeModel {

core/DownloadManager.ts:74:52 - error TS2569: Type 'Map<Buffer, DownloadInfo>' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.

74 for (const [downloadHandle, downloadInfo] of this.activeDownloads) {


core/ServiceVersionFetcher.ts:62:22 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.

62   private static get emptyServiceVersion (): ServiceVersionModel {

Found 6 errors.

thehenrytsai commented 4 years ago

Thanks @rockyhwang, not sure what you are trying to do, but have you tried running just npm run build?

rockyhwang commented 4 years ago

Thanks @rockyhwang, not sure what you are trying to do, but have you tried running just npm run build?

Hi Henry, I think the issues are related es version as I illustrated as follows. Even I add in some values to upgrade the configuration in tsconfig.json above ES5 version. It does not work to resolve these compile errors. Anyway, thanks for your comments.

Rocky

"target": "es2020",                       /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs",                     /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es2020",     
  "dom",
  "es2015.core",
  "es2015.collection",
  "es2015.generator",
  "es2015.iterable",
  "es2015.promise",
  "es2015.proxy",
  "es2015.reflect",
  "es2015.symbol",
  "es2015.symbol.wellknown",
  "esnext.asynciterable"],  
thehenrytsai commented 4 years ago

@rockyhwang, following up, have you tried directly running

npm i followed by npm run build

decentralgabe commented 1 year ago

Closing