Skip to content

Commit

Permalink
fix(ts): error TS2322
Browse files Browse the repository at this point in the history
Type 'string | void | Buffer' is not assignable to type 'string'.

Type 'void' is not assignable to type 'string'.
  • Loading branch information
dimaslanjaka committed May 3, 2023
1 parent 87303a4 commit 22faf4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/console/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ async function versionConsole() {

console.log('hexo-cli:', pkg.version);

let osInfo = '';
let osInfo: string | void | Buffer;
if (platform === 'darwin') osInfo = await spawn('sw_vers', '-productVersion');
else if (platform === 'linux') {
const v = await spawn('cat', '/etc/os-release');
const distro = (v || '').match(/NAME="(.+)"/);
const versionInfo = (v || '').match(/VERSION="(.+)"/) || ['', ''];
const distro = String(v || '').match(/NAME="(.+)"/);
const versionInfo = String(v || '').match(/VERSION="(.+)"/) || ['', ''];
const versionStr = versionInfo !== null ? versionInfo[1] : '';
osInfo = `${distro[1]} ${versionStr}`.trim() || '';
}
Expand Down

0 comments on commit 22faf4f

Please sign in to comment.