Skip to content

Commit

Permalink
Fix WebResource write typings
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
otaviojacobi committed Mar 12, 2024
1 parent 90916ad commit c04b83a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export interface WebResource {
size?: number;
};
`,
write: '',
write: `
export interface WebResourceWrite extends Blob {
name: string;
};
`,
};

const trimNL = new TemplateTag(
Expand Down Expand Up @@ -116,7 +120,7 @@ const sqlTypeToTypescriptType = (
case 'JSON':
return 'object';
case 'WebResource':
return 'WebResource';
return opts.mode === 'read' ? 'WebResource' : 'WebResourceWrite';
default:
throw new Error(`Unknown data type: '${f.dataType}'`);
}
Expand Down
10 changes: 8 additions & 2 deletions test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ const test = (
${expectation}
`);
} else {
expect(result).to.equal(expectation);
expect(result).to.equal(source`
export interface WebResourceWrite extends Blob {
name: string;
};
${expectation}
`);
}
});
};
Expand Down Expand Up @@ -358,7 +364,7 @@ test(
modified_at: Date;
id: number;
a_date: Date;
a_file: WebResource;
a_file: WebResourceWrite;
parent: number;
references__other: number;
}
Expand Down

0 comments on commit c04b83a

Please sign in to comment.