Skip to content

Commit

Permalink
Revert "fix: do not prefix promise inner types (#227)"
Browse files Browse the repository at this point in the history
This reverts commit 9560079.
  • Loading branch information
MarshallOfSound committed Jun 12, 2023
1 parent 74cfe73 commit 0fa5086
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ export const wrapComment = (comment: string, additionalTags: DocumentationTag[]
return result.concat(' */');
};

const prefixTypeForSafety = (type: string) => {
if (type !== 'Object' && typeof type === 'string' && !isPrimitive(type) && !isBuiltIn(type)) {
return `Electron.${type}`;
}
return type;
};

export const typify = (
type: TypeInformation | TypeInformation[],
maybeInnerReturnTypeName?: string,
Expand Down Expand Up @@ -211,7 +218,7 @@ export const typify = (
return '(() => void)';
case 'promise':
if (innerTypes) {
return `Promise<${typify(innerTypes[0])}>`;
return `Promise<${prefixTypeForSafety(typify(innerTypes[0]))}>`;
}
throw new Error('Promise with missing inner type');
case 'record':
Expand Down

0 comments on commit 0fa5086

Please sign in to comment.