diff --git a/lib/types.js b/lib/types.js index a5211c0e89..8926e27e2f 100644 --- a/lib/types.js +++ b/lib/types.js @@ -1727,4 +1727,8 @@ declare module "babel-types" { declare function isTSType(node: Object, opts?: Object): boolean; declare function isNumberLiteral(node: Object, opts?: Object): boolean; declare function isRegexLiteral(node: Object, opts?: Object): boolean; + declare function clone(n: T): T; + declare function cloneDeep(n: T): T; + declare function removeProperties(n: T, opts: ?{}): void; + declare function removePropertiesDeep(n: T, opts: ?{}): T; } diff --git a/scripts/generate-interfaces.js b/scripts/generate-interfaces.js index 49c796d497..3777bd114d 100644 --- a/scripts/generate-interfaces.js +++ b/scripts/generate-interfaces.js @@ -129,6 +129,13 @@ for (let i = 0; i < t.TYPES.length; i++) { ); } +lines.push( + `declare function clone(n: T): T;`, + `declare function cloneDeep(n: T): T;`, + `declare function removeProperties(n: T, opts: ?{}): void;`, + `declare function removePropertiesDeep(n: T, opts: ?{}): T;` +); + for (const type in t.FLIPPED_ALIAS_KEYS) { const types = t.FLIPPED_ALIAS_KEYS[type]; code += `type ${NODE_PREFIX}${type} = ${types