Skip to content

Commit

Permalink
Fix a type error affecting later versions of TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Nov 23, 2022
1 parent 79f8286 commit 996d04b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/workflow.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/workflow.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions src/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ export interface CodedError {
code: string;
}

function toCodedErrors<T>(errors: T): Record<keyof T, CodedError> {
return Object.entries(errors).reduce((acc, [key, value]) => {
acc[key] = { message: value, code: key };
function toCodedErrors(errors: {
[code: string]: string;
}): Record<string, CodedError> {
return Object.entries(errors).reduce((acc, [code, message]) => {
acc[code] = { message, code };
return acc;
}, {} as Record<keyof T, CodedError>);
}, {} as Record<string, CodedError>);
}

// code to send back via status report
Expand Down

0 comments on commit 996d04b

Please sign in to comment.