recoil
Version:
Recoil - A state management library for React
30 lines (24 loc) • 935 B
Flow
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails oncall+recoil
* @flow strict-local
* @format
*/
;
import type { RecoilValueReadOnly } from '../core/Recoil_RecoilValue';
const cacheWithReferenceEquality = require('../caches/Recoil_cacheWithReferenceEquality');
const selectorFamily = require('./Recoil_selectorFamily'); // flowlint-next-line unclear-type:off
const throwingSelector = selectorFamily<any, any>({
key: '__error',
get: message => () => {
throw new Error(message);
},
cacheImplementationForParams_UNSTABLE: cacheWithReferenceEquality
}); // Function that returns a selector which always throws an error
// with the provided message.
declare function errorSelector<T>(message: string): RecoilValueReadOnly<T>;
module.exports = errorSelector;