UNPKG

@mittwald/react-use-promise

Version:

Simple and declarative use of Promises in your React components. Observe their state and refresh them in various advanced ways.

25 lines (24 loc) 828 B
import { expectType } from "tsd"; import { emptyValue, setValue } from "./EventualValue.js"; // eslint-disable-next-line @typescript-eslint/no-unused-vars function testAccessingValuePropertyNeedsCheckOfIsSet() { const testValue = {}; if (testValue.isSet) { expectType(testValue.value); } else { // @ts-expect-error Value should not be set console.log(testValue.value); } } // eslint-disable-next-line @typescript-eslint/no-unused-vars function testSetValueFnCreatesWhereValueIsSet() { expectType(setValue(42).value); expectType(setValue(42).isSet); } // eslint-disable-next-line @typescript-eslint/no-unused-vars function testEmptyValueConstantIsNotSet() { // @ts-expect-error Value should not be set console.log(emptyValue.value); expectType(emptyValue.isSet); }