Page MenuHomePhabricator

[Cashtab] Convert remaining non-test files from js to ts
AbandonedPublicDraft

Authored by bytesofman on Aug 9 2025, 02:58.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

The test files are more complex and should be handled incrementally. But we need to clean these up too.

Test Plan

npm test && arc lint

Diff Detail

Repository
rABC Bitcoin ABC
Branch
ts-incremental
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 34082
Build 67633: Build Diffcashtab-tests
Build 67632: arc lint + arc unit

Event Timeline

Tail of the build log:

Run `npm audit` for details.

> ecash-lib@4.3.1 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

/work/modules/ecash-agora /work/abc-ci-builds/cashtab-tests

added 272 packages, and audited 275 packages in 1s

37 packages are looking for funding
  run `npm fund` for details

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@2.1.0 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1396 packages, and audited 2833 packages in 13s

284 packages are looking for funding
  run `npm fund` for details

17 vulnerabilities (3 low, 9 moderate, 2 high, 3 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> cashtab@3.31.14 build
> node scripts/build.js

Creating an optimized production build...
Failed to compile.

TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ bf24d955f59351e738ecd905966606a6837e478e1982943d724eab10caad82fd: { token: { tokenId: string; tokenType: { protocol: string; type: string; number: number; }; timeFirstSeen: number; genesisInfo: { ...; }; block: { ...; }; }; tx: { ...; }; calculated: { ...; }; }; ... 46 more ...; '16b12bbacdbb8c8a799adbfd782bfff984...'.
  No index signature with a parameter of type 'string' was found on type '{ bf24d955f59351e738ecd905966606a6837e478e1982943d724eab10caad82fd: { token: { tokenId: string; tokenType: { protocol: string; type: string; number: number; }; timeFirstSeen: number; genesisInfo: { ...; }; block: { ...; }; }; tx: { ...; }; calculated: { ...; }; }; ... 46 more ...; '16b12bbacdbb8c8a799adbfd782bfff984...'.
    20605 | const largeTokenCache = new CashtabCache().tokens;
    20606 | for (const tokenId of Object.keys(chronikTokenMocks)) {
  > 20607 |     const { token, calculated } = chronikTokenMocks[tokenId];
          |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
    20608 |     const { timeFirstSeen, genesisInfo, tokenType } = token;
    20609 |     const { genesisSupply, genesisOutputScripts, genesisMintBatons } =
    20610 |         calculated;


Build cashtab-tests failed with exit code 1

Tail of the build log:

Run `npm audit` for details.

> ecash-lib@4.3.1 build
> tsc && tsc -p ./tsconfig.build.json && cp -r ./src/ffi ./dist

/work/modules/ecash-agora /work/abc-ci-builds/cashtab-tests

added 272 packages, and audited 275 packages in 1s

37 packages are looking for funding
  run `npm fund` for details

7 vulnerabilities (1 low, 5 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@2.1.0 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1396 packages, and audited 2833 packages in 14s

284 packages are looking for funding
  run `npm fund` for details

17 vulnerabilities (3 low, 9 moderate, 2 high, 3 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> cashtab@3.31.14 build
> node scripts/build.js

Creating an optimized production build...
Failed to compile.

TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ bf24d955f59351e738ecd905966606a6837e478e1982943d724eab10caad82fd: { token: { tokenId: string; tokenType: { protocol: string; type: string; number: number; }; timeFirstSeen: number; genesisInfo: { ...; }; block: { ...; }; }; tx: { ...; }; calculated: { ...; }; }; ... 46 more ...; '16b12bbacdbb8c8a799adbfd782bfff984...'.
  No index signature with a parameter of type 'string' was found on type '{ bf24d955f59351e738ecd905966606a6837e478e1982943d724eab10caad82fd: { token: { tokenId: string; tokenType: { protocol: string; type: string; number: number; }; timeFirstSeen: number; genesisInfo: { ...; }; block: { ...; }; }; tx: { ...; }; calculated: { ...; }; }; ... 46 more ...; '16b12bbacdbb8c8a799adbfd782bfff984...'.
    20605 | const largeTokenCache = new CashtabCache().tokens;
    20606 | for (const tokenId of Object.keys(chronikTokenMocks)) {
  > 20607 |     const { token, calculated } = chronikTokenMocks[tokenId];
          |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
    20608 |     const { timeFirstSeen, genesisInfo, tokenType } = token;
    20609 |     const { genesisSupply, genesisOutputScripts, genesisMintBatons } =
    20610 |         calculated;


Build cashtab-tests failed with exit code 1

too complex to do it all at once. keep going incrementally