Skip to content

Commit b9186a9

Browse files
authored
Cast in template expression to not break eslint rule (#107)
1 parent 3be9fcb commit b9186a9

File tree

9 files changed

+12
-8
lines changed

9 files changed

+12
-8
lines changed

.changeset/evil-brooms-admire.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+
Cast in template expression to not break eslint rule

eslint.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default defineConfig([
1111
'@typescript-eslint/sort-type-constituents': 'off',
1212
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
1313
'@typescript-eslint/no-empty-object-type': 'off',
14-
'@typescript-eslint/restrict-template-expressions': 'off',
1514
'simple-import-sort/imports': 'off',
1615
'sort-keys-fix/sort-keys-fix': 'off',
1716
'typescript-sort-keys/interface': 'off',

src/fragments/programInstructions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function getProgramInstructionsParseFunctionFragment(
167167
const instructionType = ${programInstructionsIdentifierFunction}(instruction);
168168
switch (instructionType) {
169169
${switchCases}
170-
default: throw new Error(\`Unrecognized instruction type: \${instructionType}\`);
170+
default: throw new Error(\`Unrecognized instruction type: \${instructionType as string}\`);
171171
}
172172
}`;
173173
}

test/e2e/anchor/src/generated/programs/wenTransferGuard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,6 @@ export function parseWenTransferGuardInstruction<TProgram extends string>(
137137
};
138138
}
139139
default:
140-
throw new Error(`Unrecognized instruction type: ${instructionType}`);
140+
throw new Error(`Unrecognized instruction type: ${instructionType as string}`);
141141
}
142142
}

test/e2e/dummy/src/generated/programs/dummy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ export function parseDummyInstruction<TProgram extends string>(
9393
return { instructionType: DummyInstruction.Instruction7, ...parseInstruction7Instruction(instruction) };
9494
}
9595
default:
96-
throw new Error(`Unrecognized instruction type: ${instructionType}`);
96+
throw new Error(`Unrecognized instruction type: ${instructionType as string}`);
9797
}
9898
}

test/e2e/system/src/generated/programs/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,6 @@ export function parseSystemInstruction<TProgram extends string>(
214214
};
215215
}
216216
default:
217-
throw new Error(`Unrecognized instruction type: ${instructionType}`);
217+
throw new Error(`Unrecognized instruction type: ${instructionType as string}`);
218218
}
219219
}

test/e2e/token/src/generated/programs/associatedToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ export function parseAssociatedTokenInstruction<TProgram extends string>(
8787
};
8888
}
8989
default:
90-
throw new Error(`Unrecognized instruction type: ${instructionType}`);
90+
throw new Error(`Unrecognized instruction type: ${instructionType as string}`);
9191
}
9292
}

test/e2e/token/src/generated/programs/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ export function parseSystemInstruction<TProgram extends string>(
4747
return { instructionType: SystemInstruction.CreateAccount, ...parseCreateAccountInstruction(instruction) };
4848
}
4949
default:
50-
throw new Error(`Unrecognized instruction type: ${instructionType}`);
50+
throw new Error(`Unrecognized instruction type: ${instructionType as string}`);
5151
}
5252
}

test/e2e/token/src/generated/programs/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,6 @@ export function parseTokenInstruction<TProgram extends string>(
369369
};
370370
}
371371
default:
372-
throw new Error(`Unrecognized instruction type: ${instructionType}`);
372+
throw new Error(`Unrecognized instruction type: ${instructionType as string}`);
373373
}
374374
}

0 commit comments

Comments
 (0)