Zhihui-Platform / client

Unnecessary type assertion of an expression JS-0349
Anti-pattern
Major
5 occurrences in this check
This assertion is unnecessary since it does not change the type of the expression
 99      const m = tokens[idx].info.trim().match(/^details\s+(.*)$/);
100      if (tokens[idx].nesting === 1) {
101        return `<details class="custom-block details"><summary>${md.utils.escapeHtml(
102          m![1]103        )}</summary>\n`;
104      } else {
105        return "</details>\n";
This assertion is unnecessary since it does not change the type of the expression
 86      const m = tokens[idx].info.trim().match(/^info\s+(.*)$/);
 87      if (tokens[idx].nesting === 1) {
 88        return `<div class="custom-block info"><p class="custom-block-title">${md.utils.escapeHtml(
 89          m![1] 90        )}</p>\n`;
 91      } else {
 92        return "</div>\n";
This assertion is unnecessary since it does not change the type of the expression
 73      const m = tokens[idx].info.trim().match(/^danger\s+(.*)$/);
 74      if (tokens[idx].nesting === 1) {
 75        return `<div class="custom-block danger"><p class="custom-block-title">${md.utils.escapeHtml(
 76          m![1] 77        )}</p>\n`;
 78      } else {
 79        return "</div>\n";
This assertion is unnecessary since it does not change the type of the expression
 60      const m = tokens[idx].info.trim().match(/^warning\s+(.*)$/);
 61      if (tokens[idx].nesting === 1) {
 62        return `<div class="custom-block warning"><p class="custom-block-title">${md.utils.escapeHtml(
 63          m![1] 64        )}</p>\n`;
 65      } else {
 66        return "</div>\n";
This assertion is unnecessary since it does not change the type of the expression
 47      const m = tokens[idx].info.trim().match(/^tip\s+(.*)$/);
 48      if (tokens[idx].nesting === 1) {
 49        return `<div class="custom-block tip"><p class="custom-block-title">${md.utils.escapeHtml(
 50          m![1] 51        )}</p>\n`;
 52      } else {
 53        return "</div>\n";