Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix types #3137

Merged
merged 2 commits into from
May 23, 2022
Merged

Fix types #3137

merged 2 commits into from
May 23, 2022

Conversation

jowlee
Copy link
Contributor

@jowlee jowlee commented May 23, 2022

Description

Fixes types errors that prevents running ts-node on init scripts
ie. ts-node initScripts/mainnet.js staging-config-live.json setversion discovery-node 0.3.58 had the following error before

TSError: ⨯ Unable to compile TypeScript:
src/services/solanaAudiusData/index.ts:55:34 - error TS2339: Property 'newPublicKeyNullable' does not exist on type 'typeof import("/home/ubuntu/audius-protocol/libs/src/services/solanaWeb3Manager/utils")'.

55     this.programId = SolanaUtils.newPublicKeyNullable(programId)
                                    ~~~~~~~~~~~~~~~~~~~~
src/services/solanaAudiusData/index.ts:56:37 - error TS2339: Property 'newPublicKeyNullable' does not exist on type 'typeof import("/home/ubuntu/audius-protocol/libs/src/services/solanaWeb3Manager/utils")'.

56     this.adminAccount = SolanaUtils.newPublicKeyNullable(adminAccount)
                                       ~~~~~~~~~~~~~~~~~~~~
src/services/solanaAudiusData/index.ts:94:43 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(ArrayType: BufferConstructor, endian?: Endianness | undefined, length?: number | undefined): Buffer', gave the following error.
    Argument of type 'Uint8ArrayConstructor' is not assignable to parameter of type 'BufferConstructor'.
      Type 'Uint8ArrayConstructor' is missing the following properties from type 'BufferConstructor': isBuffer, isEncoding, byteLength, concat, and 5 more.
  Overload 2 of 2, '(ArrayType: any[], endian?: Endianness | undefined, length?: number | undefined): any[]', gave the following error.
    Argument of type 'Uint8ArrayConstructor' is not assignable to parameter of type 'any[]'.
      Type 'Uint8ArrayConstructor' is missing the following properties from type 'any[]': pop, push, concat, join, and 28 more.

94     const userIdSeed = userId.toArrayLike(Uint8Array, 'le', 4)
                                             ~~~~~~~~~~

src/services/solanaAudiusData/index.ts:219:36 - error TS2345: Argument of type '{ adminAccount?: anchor.web3.PublicKey | undefined; baseAuthorityAccount?: anchor.web3.PublicKey | undefined; bumpSeed?: number | undefined; userId: anchor.BN; ... 10 more ...; program: AudiusData.AudiusDataProgram; }' is not assignable to parameter of type 'InitUserParams'.
  Types of property 'ethAddress' are incompatible.
    Type 'string | undefined' is not assignable to type 'string'.
      Type 'undefined' is not assignable to type 'string'.

219     const tx = AudiusData.initUser({
                                       ~
220       payer: this.solanaWeb3Manager.feePayerKey,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
222       ...params
    ~~~~~~~~~~~~~~~
223     })
    ~~~~~
src/services/solanaAudiusData/index.ts:377:12 - error TS2532: Object is possibly 'undefined'.

377       cn1: spSeedAddresses[0].derivedAddress,
               ~~~~~~~~~~~~~~~~~~
src/services/solanaAudiusData/index.ts:378:12 - error TS2532: Object is possibly 'undefined'.

378       cn2: spSeedAddresses[1].derivedAddress,
               ~~~~~~~~~~~~~~~~~~
src/services/solanaAudiusData/index.ts:379:12 - error TS2532: Object is possibly 'undefined'.

379       cn3: spSeedAddresses[2].derivedAddress,
               ~~~~~~~~~~~~~~~~~~
src/services/solanaAudiusData/index.ts:426:7 - error TS2783: 'adminAccount' is specified more than once, so this usage will be overwritten.

426       adminAccount: this.adminAccount,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  src/services/solanaAudiusData/index.ts:427:7
    427       ...params
              ~~~~~~~~~
    This spread always overwrites this property.

    at createTSError (/home/ubuntu/.nvm/versions/node/v14.18.1/lib/node_modules/ts-node/src/index.ts:843:12)
    at reportTSError (/home/ubuntu/.nvm/versions/node/v14.18.1/lib/node_modules/ts-node/src/index.ts:847:19)
    at getOutput (/home/ubuntu/.nvm/versions/node/v14.18.1/lib/node_modules/ts-node/src/index.ts:1057:36)
    at Object.compile (/home/ubuntu/.nvm/versions/node/v14.18.1/lib/node_modules/ts-node/src/index.ts:1411:41)
    at Module.m._compile (/home/ubuntu/.nvm/versions/node/v14.18.1/lib/node_modules/ts-node/src/index.ts:1596:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.require.extensions.<computed> [as .ts] (/home/ubuntu/.nvm/versions/node/v14.18.1/lib/node_modules/ts-node/src/index.ts:1600:12)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (/home/ubuntu/audius-protocol/libs/src/index.js:4:30)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.require.extensions.<computed> [as .js] (/home/ubuntu/.nvm/versions/node/v14.18.1/lib/node_modules/ts-node/src/index.ts:1587:43)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  diagnosticCodes: [
    2339, 2339, 2769,
    2345, 2532, 2532,
    2532, 2783
  ]
}

Tests

Was able to run the script and run npm build

How will this change be monitored? Are there sufficient logs?

@jowlee jowlee requested a review from dmanjunath May 23, 2022 13:30
Copy link
Contributor

@dmanjunath dmanjunath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tysm

@jowlee jowlee merged commit d7d2759 into master May 23, 2022
@jowlee jowlee deleted the jowlee-fix-types branch May 23, 2022 13:40
sliptype pushed a commit that referenced this pull request Sep 10, 2023
[a82b6d2] [C-2391 PLAT-833] Handle get-discovery-notification error, notification processing (#3141) Dylan Jeffers
[b6a8470] [PAY-1073] Mobile messages settings screen (#3131) Reed
[c567b35] Separate chat text input to own component (#3142) Reed
[1a38cb1] [PAY-1090] - Subscribe to special access gates to unlock new tracks (#3108) Saliou Diallo
[9e5a45d] Set dev optimizely key (#3126) Sebastian Klingler
[c5e86fa] [PLAT-699] Add tastemaker notification to web (#3140) Dylan Jeffers
[4bc608c] [C-2295] Only show now-playing-artwork-tile when song enqueued (#3137) Dylan Jeffers
[aa34b32] [PAY-1039] Mobile chat header navs to profile (#3139) Reed
[55f5819] Optimizely attributes - use null if empty instead of undefined (#3134) nicoback2
[92ab79e] [C-2387] Improve permalink and user handle caching (#3117) Dylan Jeffers
[086af81] [PAY-1107][PAY-1112] Center mobile chat text input, enlarge icon (#3136) Reed
[fcec3f5] [PAY-1123] Fix mobile chat scroll being stuck (#3135) Reed
[a276e86] Revert "Allow Optimizely targeting w CodePush on mobile C-2394" (#3133) nicoback2
[3335b4a] [C-2357] Update the icon color of the podcast skip buttons to accept the theme color (#3132) Kyle Shanks
[1af5730] Fix dapp store versionCode (#3121) Dylan Jeffers
[7787115] Fix app store version fetched from Apple in Fastlane being out of date first 24h after new release C-2397 (#3128) nicoback2
[06c181d] Allow Optimizely targeting w CodePush on mobile C-2394 (#3127) nicoback2
[ff07c32] [PAY-1038] Fix mobile profile page button borders (#3130) Reed
[9286959] [PAY-1027] Mobile chat websockets (#3129) Reed
[81ef3b3] [PAY-1031] Mobile chat list views use full height (#3123) Reed
[41e3f5d] [C-2231] Remove audius-data, dynamically import web3modal (#1771) Raymond Jacobson
[34d80be] [PAY-1111] Remove "Done" row on ios keyboard for mobile chats (#3124) Reed
[9eb83a8] [PAY-1102] - Add supporters info drawer (#3112) Saliou Diallo
[6fe7abe] Add dependencies, bundle to mobile README (#3111) Reed
[dc8d4f2] Show header shadow in chat screens (#3106) Reed
[f871a38] [PAY-906] Mobile chats KeyboardAvoidingView (#3122) Reed
[fd00bf2] Fix chat reactions with createEntityAdapter (#3118) Reed
[9876137] Switch to 1s (#3120) Raymond Jacobson
[fe9efea] Tip using both erc_wallet and wallet (#3049) Michael Piazza
[fdfc0b6] Update dapp store readme (#3119) Raymond Jacobson
[ca58e69] [C-2359, C-2380] Update duration text for podcast tiles (#3116) Kyle Shanks
[6441421] [PLAT-695] Add trending notifications to valid_types (#3109) Dylan Jeffers
[4233ee6] [PAY-1083] - Only allow prompt modal when single track is being uploaded (#3115) Saliou Diallo
[36909d1] Always include user signature for stream (#3114) Raymond Jacobson
[b90eaf6] [C-2386] Fix notification button not toggling panel (#3110) Dylan Jeffers
[a3c2e91] Check if messagesStatus undefined in ChatScreen (#3113) Reed
[64d89ca] [C-2382] Update dapp-store cli, short_description length (#3104) Dylan Jeffers
[680931d] [C-2361, C-2360, C-2355, C-2346] Update skip 15s button behavior on mobile for podcasts (#3105) Kyle Shanks
[3eb742f] [C-2353, C-2358] Update playback position tracking for web and mobile (#3097) Kyle Shanks
[e06c4d9] Bump sdk to 2.0.3-beta.1 (#3098) Isaac Solo
[8191694] Fix "Pick some for me" button on android (#3102) Sebastian Klingler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants