Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Cascade Bumping of dependencies after release cause typing error while rebuilding #2533

Closed
vallhallalm opened this issue Apr 19, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@vallhallalm
Copy link

Overview

Hi,
While trying to reinstall the packages of my typescript application using npm v10.5.0 (node v20.12.1) I came across an issue that led me not to be able to build (using ./node_modules/typescript/bin/tsc). solana-web3.js has had a really recent release and it seems like the update of solana-web3.js create a cascade of dependencies update that leads me to the following kind of error:

node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts:72:44 - error TS1139: Type parameter declaration expected.

72 export declare function getDataEnumEncoder<const TVariants extends Variants<Encoder<any>>>(variants: TVariants, config?: DataEnumCodecConfig<NumberEncoder>): Encoder<GetEncoderTypeFromVariants<TVariants>>;
                                              ~~~~~

node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts:72:60 - error TS1005: ',' expected.

72 export declare function getDataEnumEncoder<const TVariants extends Variants<Encoder<any>>>(variants: TVariants, config?: DataEnumCodecConfig<NumberEncoder>): Encoder<GetEncoderTypeFromVariants<TVariants>>;
                                                              ~~~~~~~

node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts:72:76 - error TS1005: ',' expected.

72 export declare function getDataEnumEncoder<const TVariants extends Variants<Encoder<any>>>(variants: TVariants, config?: DataEnumCodecConfig<NumberEncoder>): Encoder<GetEncoderTypeFromVariants<TVariants>>;

Steps to reproduce

In a typescript app that contains "@solana/web3.js" as a dependencies in the package.json and which was not already updated after the recent release:
delete node_modules folder,
delete package-lock.json file,
run npm i,
run ./node_modules/typescript/bin/tsc

You should obtain the same kind of error as shown before.

Description of bug

When running ./node_modules/typescript/bin/tsc after installing back my node_modules I got the errors provided earlier. I expect not to get these errors just by installing back my packages

Thanks in advance for your help

@vallhallalm vallhallalm added the bug Something isn't working label Apr 19, 2024
@lolelu
Copy link

lolelu commented Apr 19, 2024

Same bug here.

@TiaLanzi
Copy link

Same bug here

@djloa
Copy link

djloa commented Apr 19, 2024

same bug here

@lolelu
Copy link

lolelu commented Apr 19, 2024

For now, adding an override in package.json seems to be enough to solve the issue.

"overrides": { "@solana/spl-token": "0.3.5" }

spl-token library got updated in the last realease and it brings some broken references in.

@steveluscher
Copy link
Contributor

Help me understand a bit more about what's going on here:

Things I know:

  • I screwed up the publish of @solana/spl-token yesterday; the versions 0.4.4 and 0.4.5 have been deprecated on NPM. If you were unlucky enough to get one of those stuck in your package lockfile, move to 0.4.6.

@lolelu
Copy link

lolelu commented Apr 19, 2024

As far as i managed to understand, @solana/codecs-data-structures is a dependency of @solana/codecs, which is
somehow a dependency of @solana/spl-token, but only in version 0.4.5. Also, it doesn't bring in a stable version of @solana-codecs, but an unstable/preview one: @solana/codecs-data-structures

@lolelu
Copy link

lolelu commented Apr 19, 2024

Additionally, the package got updated litterally 4 hours ago, so it might be fixed by now.

@steveluscher
Copy link
Contributor

I tried typechecking with @solana/[email protected] and it works. I'm pretty sure this is just my mistake from yesterday, and you all were unlucky enough to install 0.4.4 or 0.4.5 in your apps. Sorry about that. Please upgrade to 0.4.6.

@steveluscher
Copy link
Contributor

Also possible: The TypeScript feature (const type parameters) in the OP was introduced in TypeScript 5. If you're on 4 you should upgrade.

@statikdev
Copy link

statikdev commented Apr 23, 2024

I am running into this same issue (0.4.6 of spl-token)

project:build: ../node_modules/.pnpm/@[email protected]/node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts(72,44): error TS1139: Type parameter declaration expected.
project:build: ../node_modules/.pnpm/@[email protected]/node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts(72,60): error TS1005: ',' expected.
project:build: ../node_modules/.pnpm/@[email protected]/node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts(72,76): error TS1005: ',' expected.
project:build: ../node_modules/.pnpm/@[email protected]/node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts(72,90): error TS1109: Expression expected.
project:build: ../node_modules/.pnpm/@[email protected]/node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts(72,100): error TS1005: ')' expected.
project:build: ../node_modules/.pnpm/@[email protected]/node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts(72,120): error TS1109: Expression expected.
project:build: ../node_modules/.pnpm/@[email protected]/node_modules/@solana/codecs-data-structures/dist/types/data-enum.d.ts(72,156): error TS1005: ';' expected.

As far as i managed to understand, @solana/codecs-data-structures is a dependency of @solana/codecs, which is
somehow a dependency of @solana/spl-token, but only in version 0.4.5. Also, it doesn't bring in a stable version of @solana-codecs, but an unstable/preview one: @solana/codecs-data-structures

The dependency resolution for me was to:

https://www.npmjs.com/package/@solana/codecs-data-structures/v/2.0.0-preview.2

Also possible: The TypeScript feature (const type parameters) in the OP was introduced in TypeScript 5. If you're on 4 you should upgrade.

what options do we have if we cannot upgrade to typescript 5?

@steveluscher
Copy link
Contributor

You could consider patch-package to codemod out the const keyword, but you should upgrade to TypeScript 5 if at all possible.

Copy link
Contributor

github-actions bot commented May 8, 2024

Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants