Skip to content

Commit

Permalink
Implemented #543: better typings for toJS
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Nov 16, 2016
1 parent 30c4f69 commit e40fc86
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api/tojs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(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
Expand Down

0 comments on commit e40fc86

Please sign in to comment.