Skip to content

Svelte supports rxjs observables but it is not reflected in types #8726

@olehmisar

Description

@olehmisar

Describe the bug

I cannot use an rxjs.Observable with derived because svelte's Unsubscriber is not typed properly:

/** Unsubscribes from value updates. */
export type Unsubscriber = () => void;

It should be typed as

export type Unsubscriber = { unsubscribe(): void; } | (() => void);

Reproduction

import { of } from 'rxjs'
const value = of(0);
derived(value, value => value + 2) // type error

Logs

No response

System Info

not relevant

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions