Merge pull request #106 from Leeds-eBooks/patch/flow-errors-3

Revert to old flow syntax (always named function arguments)
This commit is contained in:
Michael Diarmid 2017-05-10 19:05:45 +01:00 committed by GitHub
commit c7eb09ddd5
2 changed files with 11 additions and 3 deletions

View File

@ -375,8 +375,16 @@ export default class Reference extends ReferenceBase {
* @param onComplete
* @param applyLocally
*/
transaction(transactionUpdate: Function, onComplete: (?Error, boolean, ?Snapshot) => *, applyLocally: boolean = false) {
if (!isFunction(transactionUpdate)) return Promise.reject(new Error('Missing transactionUpdate function argument.'));
transaction(
transactionUpdate: Function,
onComplete: (error: ?Error, committed: boolean, snapshot: ?Snapshot) => *,
applyLocally: boolean = false
) {
if (!isFunction(transactionUpdate)) {
return Promise.reject(
new Error('Missing transactionUpdate function argument.')
);
}
return new Promise((resolve, reject) => {
const onCompleteWrapper = (error, committed, snapshotData) => {

View File

@ -165,7 +165,7 @@ export function promisify(
fn: Function | string,
NativeModule: Object,
errorPrefix?: string
): (any) => Promise<> {
): (args: any) => Promise<> {
return (...args) => {
return new Promise((resolve, reject) => {
const _fn = typeof fn === 'function' ? fn : NativeModule[fn];