/
githubmr
/
facebook-react-native
Обзор
Документация
Войти
/
githubmr
/
facebook-react-native
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/react-native/src/private/__tests__/utilities/ensureInstance.js
21 строка
524 B
Sam Zhou
Replace $FlowIssue with $FlowFixMe (#52976)
01 авг 2025, 17:50
01 авг 2025, 17:50
c43a399
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict * @format */ export default function ensureInstance<T>(value: mixed, Class: Class<T>): T { if (!(value instanceof Class)) { // $FlowFixMe[incompatible-use] const className = Class.name; throw new Error( `Expected instance of ${className} but got ${String(value)}`, ); } return value; }