Skip to content

Commit

Permalink
fix: generate correct type for dict/record
Browse files Browse the repository at this point in the history
  • Loading branch information
runeh committed Jun 9, 2021
1 parent 388d622 commit 8037530
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ describe('anyTypeToTsType', () => {
lasers?: string;
readonly feelings: string;
};
dictionaryKind: Dictionary<string, number>;
dictionaryKind: Record<string, number>;
namedKind: foo;
literalNumberKind: 1;
literalStringKind: \\"foo\\";
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export function anyTypeToTsType(
return type.types.map((e) => anyTypeToTsType(e, opts)).join(' & ');

case 'dictionary':
return `Dictionary<string, ${anyTypeToTsType(type.valueType, opts)}>`;
return `Record<string, ${anyTypeToTsType(type.valueType, opts)}>`;

case 'named':
return opts.formatTypeName(type.name);
Expand Down

0 comments on commit 8037530

Please sign in to comment.