From e40fc86a7161f5497ec8d185c67904adfbbbdb31 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Wed, 16 Nov 2016 22:07:14 +0100 Subject: [PATCH] Implemented #543: better typings for `toJS` --- src/api/tojs.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/api/tojs.ts b/src/api/tojs.ts index 67a3e19b3..886187c77 100644 --- a/src/api/tojs.ts +++ b/src/api/tojs.ts @@ -8,6 +8,9 @@ import {deprecated, isArrayLike} from "../utils/utils"; /** * Basically, a deep clone, so that no reactive property will exist anymore. */ +export function toJS(source: T, detectCycles?: boolean): T; +export function toJS(source: any, detectCycles?: boolean): any; +export function toJS(source, detectCycles: boolean, __alreadySeen: [any, any][]); // internal overload export function toJS(source, detectCycles: boolean = true, __alreadySeen: [any, any][] = null) { // optimization: using ES6 map would be more efficient! // optimization: lift this function outside toJS, this makes recursion expensive