Skip to content

Commit

Permalink
fix: intersection was generated with wrong name
Browse files Browse the repository at this point in the history
  • Loading branch information
runeh committed Mar 28, 2021
1 parent d238f85 commit f94d755
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ describe('runtype generation', () => {
expect(raw).toMatchInlineSnapshot(`
"import * as rt from \\"runtypes\\";
const test = rt.intersect(
const test = rt.Intersect(
rt.Record({ field_1: rt.String }),
rt.Record({ field_2: rt.String }).asPartial(),
rt.Record({ field_3: rt.String }).asReadonly(),
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function groupFieldKinds(
function writeRecordType(w: CodeWriter, node: RecordType) {
const fieldKinds = groupFieldKinds(node.fields);
const hasMultiple = fieldKinds.length > 1;
w.conditionalWrite(hasMultiple, 'rt.intersect(');
w.conditionalWrite(hasMultiple, 'rt.Intersect(');
for (const fieldKind of fieldKinds) {
w.write('rt.Record({');
for (const field of fieldKind.fields) {
Expand Down

0 comments on commit f94d755

Please sign in to comment.