Best effort of extending immutable declaration

Summary:
It's still very much incomplete but this now exports
some of the top-level functions I'm about to use.

I'd love to just import f71ccd5db2/type-definitions/immutable.js.flow but this doesn't actually work as a module declaration because top-level type declarations are incompatible with it at the moment ... sigh.

Reviewed By: danielbuechele

Differential Revision: D10378353

fbshipit-source-id: 3023882b8bd38cf25d9a6c97905ff71548105775
This commit is contained in:
Pascal Hartig
2018-10-16 03:05:53 -07:00
committed by Facebook Github Bot
parent b367e38050
commit 9f24f05167

View File

@@ -21,6 +21,10 @@
* @flow * @flow
*/ */
// Helper type that represents plain objects allowed as arguments to
// some constructors and functions.
type PlainObjInput<K, V> = {+[key: K]: V, __proto__: null};
declare module 'immutable' { declare module 'immutable' {
/** /**
* This file provides type definitions for use with the Flow type checker. * This file provides type definitions for use with the Flow type checker.
@@ -1227,37 +1231,18 @@ declare module 'immutable' {
declare function is(first: mixed, second: mixed): boolean; declare function is(first: mixed, second: mixed): boolean;
declare function hash(value: mixed): number; declare function hash(value: mixed): number;
}
/** declare function merge<C>(
* BSD License collection: C,
* ...collections: Array<Iterable<C> | PlainObjInput<C, any>>
* For Immutable JS software ): C;
* declare function mergeDeep<C>(
* Copyright (c) 2014-2015, Facebook, Inc. All rights reserved. collection: C,
* ...collections: Array<Iterable<C> | PlainObjInput<C, any>>
* Redistribution and use in source and binary forms, with or without modification, ): C;
* are permitted provided that the following conditions are met: declare function mergeDeepWith<C>(
* merger: (oldVal: any, newVal: any, key: any) => mixed,
* * Redistributions of source code must retain the above copyright notice, this collection: C,
* list of conditions and the following disclaimer. ...collections: Array<Iterable<C> | PlainObjInput<C, any>>
* ): C;
* * Redistributions in binary form must reproduce the above copyright notice, }
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name Facebook nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/