js-deprecated
js-deprecated copied to clipboard
'"@solana/web3.js"' has no exported member 'TransactionCtorFields'.
Hi everyone, I am trying to integrate metaplex to my angular project but on import I've got the following error:
Error: node_modules/@metaplex/js/lib/transactions/PayForFiles.d.ts:3:21 - error TS2305: Module '"@solana/web3.js"' has no exported member 'TransactionCtorFields'.
To Reproduce Steps to reproduce the behavior:
- installl the metaplex library with: npm install @metaplex/js
- add this to your actual code import { Connection, programs } from '@metaplex/js'; const { metadata: { Metadata } } = programs;
- compile
- See error
...
Error: node_modules/@metaplex/js/lib/transactions/MintTo.d.ts:1:21 - error TS2305: Module '"@solana/web3.js"' has no exported member 'TransactionCtorFields'.
1 import { PublicKey, TransactionCtorFields } from '@solana/web3.js';
~~~~~~~~~~~~~~~~~~~~~
Error: node_modules/@metaplex/js/lib/transactions/PayForFiles.d.ts:3:21 - error TS2305: Module '"@solana/web3.js"' has no exported member 'TransactionCtorFields'.
3 import { PublicKey, TransactionCtorFields } from '@solana/web3.js';
~~~~~~~~~~~~~~~~~~~~~
...
Notes Looks like that TransactionCtorFields is deprecated. I found some reference here: https://solana-labs.github.io/solana-web3.js/modules.html#TransactionCtorFields_DEPRECATED and the relative issue on solana labs here: https://github.com/solana-labs/solana/issues/23949
Any suggestion on how solve the issue? Thank you all in advance.
I am using https://www.typescriptlang.org/tsconfig#skipLibCheck until this issue is resolved. I think the problem is that @solana/web3.js is a package dependency instead of peer dependency. If it would be a peer dep, then we could downgrade @solana/web3.js package to a version that has TransactionCtorFields. I just don't understand why the devs at @solana/web3.js decided to rename the TransactionCtorFields to TransactionCtorFields_DEPRECATED. This is not how you deprecate anything
Sorry about this. The real problem here is that we export way too much stuff from web3.js, and the only reason we export a type like this that's fundamentally internal is because of TypeDoc (the thing that generates our documentation). I plan not to make this mistake again when we rewrite web3.js.
I will send a PR now to fix this once and for all.