/** * Copyright (c) 2017-present A. Matías Quezada */ /** * Decorates a method to allow only the last call to be fulfilled. * This will prevent race conditions where previous calls being fullfilled after * the last call will overwrite the output. * Use with caution! Previous calls will be left unfulfilled which is considered an anti-pattern. * * @link http://jsfiddle.net/amatiasq/zhmz8xdx/ * * @param {Function} fn Function to be decorated. * @returns {Function} The decorated function. */ export default function raceCondition(fn: (...args: TArgs[]) => Promise): (...args: TArgs[]) => Promise;