Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/core/src/bind/connectFactoryObservable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ describe("connectFactoryObservable", () => {
const [useDelayedNumber, getDelayedNumber$] = bind((x: number) =>
of(x).pipe(delay(50)),
)
const Result: React.FC = (p) => (
const Result: React.FC<{ input: number }> = (p) => (
<div>Result {useDelayedNumber(p.input)}</div>
)
const TestSuspense: React.FC = () => {
Expand Down Expand Up @@ -316,7 +316,7 @@ describe("connectFactoryObservable", () => {
})

it("allows errors to be caught in error boundaries", () => {
const errStream = new Subject()
const errStream = new Subject<any>()
const [useError] = bind(() => errStream, 1)

const ErrorComponent = () => {
Expand All @@ -343,7 +343,7 @@ describe("connectFactoryObservable", () => {
})

it("allows sync errors to be caught in error boundaries with suspense", () => {
const errStream = new Observable((observer) =>
const errStream = new Observable<any>((observer) =>
observer.error("controlled error"),
)
const [useError, getErrStream$] = bind((_: string) => errStream)
Expand Down Expand Up @@ -374,7 +374,7 @@ describe("connectFactoryObservable", () => {
})

it("allows async errors to be caught in error boundaries with suspense", async () => {
const errStream = new Subject()
const errStream = new Subject<any>()
const [useError, getErrStream$] = bind((_: string) => errStream)

const ErrorComponent = () => {
Expand Down Expand Up @@ -424,7 +424,7 @@ describe("connectFactoryObservable", () => {
.pipe(catchError(() => []))
.subscribe()

const Ok: React.FC = ({ ok }) => <>{useOkKo(ok)}</>
const Ok: React.FC<{ ok: boolean }> = ({ ok }) => <>{useOkKo(ok)}</>

const ErrorComponent = () => {
const [ok, setOk] = useState(true)
Expand Down Expand Up @@ -839,7 +839,7 @@ describe("connectFactoryObservable", () => {
const [, obs$] = bind(
(key: number) => defer(() => obs$(key)).pipe(take(1)),
(key: number) => key,
) as [(key: number) => number, (key: number) => Observable]
) as [(key: number) => number, (key: number) => Observable<number>]

let error = null
obs$(1)
Expand All @@ -856,7 +856,7 @@ describe("connectFactoryObservable", () => {
it("does not crash when the factory function self-references its enhanced self", () => {
let nSubscriptions = 0
const [, me$] = bind(
(key: number): Observable => {
(key: number): Observable<number> => {
nSubscriptions++
return defer(() => me$(key)).pipe(
take(1),
Expand Down
16 changes: 8 additions & 8 deletions packages/core/src/bind/connectObservable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ describe("connectObservable", () => {
const [useNumber] = bind(numberStream, 1)
const [useString] = bind(stringStream, "a")

const BatchComponent: FC = ({ onUpdate }) => {
const BatchComponent: FC<{ onUpdate: () => void }> = ({ onUpdate }) => {
const number = useNumber()
const string = useString()
useEffect(onUpdate)
Expand Down Expand Up @@ -329,7 +329,7 @@ describe("connectObservable", () => {
})

it("doesn't enter suspense if the observable emits a promise", async () => {
const subject$ = new Subject<Promise>()
const subject$ = new Subject<Promise<any>>()
const [usePromise, promise$] = bind(subject$, null)
const Result: React.FC = () => {
const value = usePromise()
Expand Down Expand Up @@ -432,7 +432,7 @@ describe("connectObservable", () => {
})

it("allows errors to be caught in error boundaries", () => {
const errStream = new Subject()
const errStream = new Subject<any>()
const [useError] = bind(errStream, 1)

const ErrorComponent = () => {
Expand All @@ -458,7 +458,7 @@ describe("connectObservable", () => {
})

it("allows sync errors to be caught in error boundaries with suspense, using source$", () => {
const errStream = new Observable((observer) =>
const errStream = new Observable<any>((observer) =>
observer.error("controlled error"),
)
const [useError, errStream$] = bind(errStream)
Expand All @@ -485,7 +485,7 @@ describe("connectObservable", () => {
})

it("allows sync errors to be caught in error boundaries with suspense, without using source$", () => {
const errStream = new Observable((observer) =>
const errStream = new Observable<any>((observer) =>
observer.error("controlled error"),
)
const [useError] = bind(errStream)
Expand All @@ -512,7 +512,7 @@ describe("connectObservable", () => {
})

it("allows sync errors to be caught in error boundaries when there is a default value", () => {
const errStream = new Observable((observer) =>
const errStream = new Observable<any>((observer) =>
observer.error("controlled error"),
)
const [useError, errStream$] = bind(errStream, 0)
Expand All @@ -539,7 +539,7 @@ describe("connectObservable", () => {
})

it("allows async errors to be caught in error boundaries with suspense", async () => {
const errStream = new Subject()
const errStream = new Subject<any>()
const [useError, errStream$] = bind(errStream)
const errStream$WithoutErrors = errStream$.pipe(catchError(() => NEVER))

Expand Down Expand Up @@ -719,7 +719,7 @@ describe("connectObservable", () => {
})

it("should throw an error if the stream completes without emitting while on SUSPENSE", async () => {
const subject = new Subject()
const subject = new Subject<any>()
const [useValue, value$] = bind(subject)
const errorCallback = vi.fn()

Expand Down