Check for param.test type instead of casting to any
MODIFY
packages/@romejs/js-compiler/transforms/lint/noDuplicateCase.ts
packages/@romejs/js-compiler/transforms/lint/noDuplicateCase.ts
@@ -17,16 +17,18 @@ export default {
let uniqueSwitchCases = new Set();
for (const param of node.cases) {
- const test: any = param.test;
+ if (param.test && param.test.type === 'StringLiteral') {
+ const {test} = param;
- if (test && test.value && uniqueSwitchCases.has(test.value)) {
+ if (uniqueSwitchCases.has(test.value)) {
context.addNodeDiagnostic(param, {
category: 'lint/noDuplicateCase',
message: `Duplicate case <emphasis>${test.value}</emphasis> not allowed`,
});
}
- test && uniqueSwitchCases.add(test.value);
+ uniqueSwitchCases.add(test.value);
+ }
}
}

Check for param.test type instead of casting to any