diff --git a/src/create.ts b/src/create.ts index b74a636..43f0122 100644 --- a/src/create.ts +++ b/src/create.ts @@ -149,7 +149,11 @@ function create(arg0: any, arg1: any, arg2?: any): any { if (rawReturnValue) { const _value = rawReturnValue[0]; if (_options.strict && typeof value === 'object' && value !== null) { - handleReturnValue({ rootDraft: proxyDraft, value, useRawReturn: true }); + handleReturnValue({ + rootDraft: proxyDraft, + value, + useRawReturn: true, + }); } return finalize([_value]); } diff --git a/src/rawReturn.ts b/src/rawReturn.ts index 2bca9bc..b9c9da0 100644 --- a/src/rawReturn.ts +++ b/src/rawReturn.ts @@ -31,7 +31,7 @@ export function rawReturn(value: T): T { (typeof value !== 'object' || value === null) ) { console.warn( - 'rawReturn() must be called with an object or `undefined`, other types do not need to be returned via rawReturn().' + 'rawReturn() must be called with an object(including plain object, arrays, Set, Map, etc.) or `undefined`, other types do not need to be returned via rawReturn().' ); } return { diff --git a/test/rawReturn.test.ts b/test/rawReturn.test.ts index 3c85e61..fbf2d06 100644 --- a/test/rawReturn.test.ts +++ b/test/rawReturn.test.ts @@ -221,7 +221,7 @@ test('error args', () => { ].forEach((value: any) => { create({}, () => rawReturn(value)); expect(logSpy).toHaveBeenCalledWith( - 'rawReturn() must be called with an object or `undefined`, other types do not need to be returned via rawReturn().' + 'rawReturn() must be called with an object(including plain object, arrays, Set, Map, etc.) or `undefined`, other types do not need to be returned via rawReturn().' ); logSpy.mockClear(); });