Skip to content

Commit

Permalink
fix: do not assume roc doc content is an object
Browse files Browse the repository at this point in the history
  • Loading branch information
stropitek committed Aug 3, 2023
1 parent a262190 commit db0c0e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/roc/RocDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const defaultRocOptions: RocDocumentOptions = {
allowAttachmentOverwrite: true,
};
export default class RocDocument<
ContentType extends Record<string, any> = Record<string, unknown>,
ContentType = Record<string, unknown>,
IdType = string,
> {
private request: AxiosInstance;
Expand Down Expand Up @@ -78,7 +78,7 @@ export default class RocDocument<
deleteAttachments?: string[],
axiosOptions?: RocAxiosRequestOptions,
): Promise<IEntryDocument<ContentType, IdType>> {
if ('_id' in content) {
if (typeof content === 'object' && '_id' in content) {
throw new Error(
'Your content contains an _id proprerty. This is probably an error since you should not pass the entire document, only $content',
);
Expand Down

0 comments on commit db0c0e3

Please sign in to comment.