Skip to content

Commit d740676

Browse files
committed
Update TypeScript configuration and import statements for module compatibility for nodejs 23+
1 parent 69d6179 commit d740676

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

basics/checking-accounts/anchor/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"type": "module",
23
"dependencies": {
34
"@coral-xyz/anchor": "^0.30.0",
45
"@solana/web3.js": "^1.95.2"

basics/checking-accounts/anchor/tests/bankrun.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import { Keypair, SystemProgram, Transaction, sendAndConfirmTransaction } from '
44
import { PublicKey } from '@solana/web3.js';
55
import { BankrunProvider } from 'anchor-bankrun';
66
import { startAnchor } from 'solana-bankrun';
7-
import type { AnchorProgramExample } from '../target/types/anchor_program_example';
7+
import type { AnchorProgramExample } from '../target/types/anchor_program_example.ts';
88

9-
const IDL = require('../target/idl/anchor_program_example.json');
9+
import IDL from '../target/idl/anchor_program_example.json' with { type: 'json' };
1010
const PROGRAM_ID = new PublicKey(IDL.address);
1111

1212
describe('Bankrun example', async () => {
1313
const context = await startAnchor('', [{ name: 'anchor_program_example', programId: PROGRAM_ID }], []);
1414
const provider = new BankrunProvider(context);
1515

1616
const wallet = provider.wallet as anchor.Wallet;
17-
const program = new anchor.Program<AnchorProgramExample>(IDL, provider);
17+
const program = new anchor.Program<AnchorProgramExample>(IDL as AnchorProgramExample, provider);
1818
const client = context.banksClient;
1919

2020
// We'll create this ahead of time.

basics/checking-accounts/anchor/tests/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as anchor from '@coral-xyz/anchor';
22
import { Keypair, SystemProgram, Transaction, sendAndConfirmTransaction } from '@solana/web3.js';
3-
import type { AnchorProgramExample } from '../target/types/anchor_program_example';
3+
import type { AnchorProgramExample } from '../target/types/anchor_program_example.ts';
44

55
describe('Anchor example', () => {
66
const provider = anchor.AnchorProvider.env();

basics/checking-accounts/anchor/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"types": ["mocha", "chai"],
44
"typeRoots": ["./node_modules/@types"],
55
"lib": ["es2015"],
6-
"module": "commonjs",
6+
"module": "nodenext",
77
"target": "es6",
8-
"esModuleInterop": true
8+
"resolveJsonModule": true
99
}
1010
}

0 commit comments

Comments
 (0)