We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e49871d + 061238a commit 782a0dcCopy full SHA for 782a0dc
src/to-plain-object.ts
@@ -6,7 +6,16 @@ import copy from 'fast-copy'
6
* @param data - Any plain JSON response returned from the API
7
* @return Enhanced object with toPlainObject method
8
*/
9
-export default function toPlainObject(data: unknown) {
+export default function toPlainObject<T = Record<string, unknown>, R = T>(
10
+ data: T
11
+): T & {
12
+ /**
13
+ * Returns this entity as a plain JS object
14
+ */
15
+ toPlainObject(): R
16
+} {
17
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
18
+ // @ts-expect-error
19
return Object.defineProperty(data, 'toPlainObject', {
20
enumerable: false,
21
configurable: false,
0 commit comments