Skip to content

Commit

Permalink
Optimized types
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Nov 30, 2024
1 parent bf7d484 commit 990970b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/createMd.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function showState(state, lines) {
line.push(state.defaultRole || '');

// 3 - Unit
line.push(state.defaultUnit || '' + (state.unit ? ` / ${state.unit}` : ''));
line.push(state.defaultUnit || (state.unit ? ` / ${state.unit}` : ''));
line.push(typeof state.type === 'object' ? state.type.join('/') : state.type || '');
line.push(state.write ? 'W' : state.write === false ? '-' : '');

Expand All @@ -50,7 +50,7 @@ function showState(state, lines) {

line.push(state.multiple ? 'x' : ' ');

line.push(state.role ? '``' + state.role.toString().replace(/\|/g, '|') + '``' : ''); //escape | character inside table cell!
line.push(state.role ? `\`\`${state.role.toString().replace(/\|/g, '|')}\`\`` : ''); //escape | character inside table cell!

return line;
}
Expand Down
3 changes: 1 addition & 2 deletions src/ChannelDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ export class ChannelDetector {

private static copyState(oldState: InternalDetectorState, newState?: DetectorState): DetectorState {
const _newState: DetectorState = newState || JSON.parse(JSON.stringify(oldState));
// @ts-expect-error original is internal state
_newState.original = oldState.original || oldState;
_newState.original = (oldState as DetectorState).original || oldState;
if ('enums' in oldState && oldState.enums) {
_newState.enums = oldState.enums;
}
Expand Down

0 comments on commit 990970b

Please sign in to comment.