Skip to content

Commit 992176b

Browse files
authored
Update generated JS code to be more linter/formatter friendly (#739)
1 parent 47db3e5 commit 992176b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+67
-62
lines changed

.changeset/fuzzy-emus-hammer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@codama/renderers-js': patch
3+
---
4+
5+
Update generated JS code to be more linter/formatter friendly

packages/renderers-js/e2e/anchor/src/generated/instructions/createGuard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ export function parseCreateGuardInstruction<
519519
}
520520
let accountIndex = 0;
521521
const getNextAccount = () => {
522-
const accountMeta = instruction.accounts![accountIndex]!;
522+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
523523
accountIndex += 1;
524524
return accountMeta;
525525
};

packages/renderers-js/e2e/anchor/src/generated/instructions/execute.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export function parseExecuteInstruction<
397397
}
398398
let accountIndex = 0;
399399
const getNextAccount = () => {
400-
const accountMeta = instruction.accounts![accountIndex]!;
400+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
401401
accountIndex += 1;
402402
return accountMeta;
403403
};

packages/renderers-js/e2e/anchor/src/generated/instructions/initialize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export function parseInitializeInstruction<
355355
}
356356
let accountIndex = 0;
357357
const getNextAccount = () => {
358-
const accountMeta = instruction.accounts![accountIndex]!;
358+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
359359
accountIndex += 1;
360360
return accountMeta;
361361
};

packages/renderers-js/e2e/anchor/src/generated/instructions/updateGuard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ export function parseUpdateGuardInstruction<
429429
}
430430
let accountIndex = 0;
431431
const getNextAccount = () => {
432-
const accountMeta = instruction.accounts![accountIndex]!;
432+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
433433
accountIndex += 1;
434434
return accountMeta;
435435
};

packages/renderers-js/e2e/anchor/src/generated/shared/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
* @internal
2424
*/
2525
export function expectSome<T>(value: T | null | undefined): T {
26-
if (value == null) {
26+
if (value === null || value === undefined) {
2727
throw new Error('Expected a value but received null or undefined.');
2828
}
2929
return value;
@@ -48,7 +48,7 @@ export function expectAddress<T extends string = string>(
4848
return value.address;
4949
}
5050
if (Array.isArray(value)) {
51-
return value[0];
51+
return value[0] as Address<T>;
5252
}
5353
return value as Address<T>;
5454
}

packages/renderers-js/e2e/dummy/src/generated/instructions/instruction6.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function parseInstruction6Instruction<
8484
}
8585
let accountIndex = 0;
8686
const getNextAccount = () => {
87-
const accountMeta = instruction.accounts![accountIndex]!;
87+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
8888
accountIndex += 1;
8989
return accountMeta;
9090
};

packages/renderers-js/e2e/dummy/src/generated/instructions/instruction7.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function parseInstruction7Instruction<
8484
}
8585
let accountIndex = 0;
8686
const getNextAccount = () => {
87-
const accountMeta = instruction.accounts![accountIndex]!;
87+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
8888
accountIndex += 1;
8989
return accountMeta;
9090
};

packages/renderers-js/e2e/dummy/src/generated/shared/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
* @internal
2424
*/
2525
export function expectSome<T>(value: T | null | undefined): T {
26-
if (value == null) {
26+
if (value === null || value === undefined) {
2727
throw new Error('Expected a value but received null or undefined.');
2828
}
2929
return value;
@@ -48,7 +48,7 @@ export function expectAddress<T extends string = string>(
4848
return value.address;
4949
}
5050
if (Array.isArray(value)) {
51-
return value[0];
51+
return value[0] as Address<T>;
5252
}
5353
return value as Address<T>;
5454
}

packages/renderers-js/e2e/memo/src/generated/shared/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
* @internal
2424
*/
2525
export function expectSome<T>(value: T | null | undefined): T {
26-
if (value == null) {
26+
if (value === null || value === undefined) {
2727
throw new Error('Expected a value but received null or undefined.');
2828
}
2929
return value;
@@ -48,7 +48,7 @@ export function expectAddress<T extends string = string>(
4848
return value.address;
4949
}
5050
if (Array.isArray(value)) {
51-
return value[0];
51+
return value[0] as Address<T>;
5252
}
5353
return value as Address<T>;
5454
}

0 commit comments

Comments
 (0)