Skip to content

Commit

Permalink
Fix type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Oct 3, 2018
1 parent c5dadca commit d9696cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/addons.ts
Expand Up @@ -10,12 +10,12 @@ export interface Addons {
hash: Uint8Array;
}

function evalIfFn<T = string>(strOrFn: T | (() => T | Promise<T>)) {
function evalIfFn(strOrFn: string | (() => string | Promise<string>)): string | Promise<string> {
switch (typeof strOrFn) {
case 'function':
return (<() => T | Promise<T>>strOrFn)();
return strOrFn();
case 'string':
return <T>strOrFn;
return strOrFn;
default:
return '';
}
Expand Down

0 comments on commit d9696cc

Please sign in to comment.