import { Subject } from 'rxjs'; /** * `source` returns an object that extends an RxJS [Subject](https://rxjs.dev/guide/subject) with an extra `type: string` property, and is also callable directly. * When using a `source`, you can provide a `type` argument, which will appear as the action type in Redux DevTools: * * ![Action Type in Redux Devtools](https://state-adapt.github.io/assets/devtools-add$.png) * * In the future we want to add a build step to add this annotation automatically. That is why source types are optional. * * #### Example: Creating a source without a type * * ```typescript * import { source } from '@state-adapt/rxjs'; * * const add$ = source(); * * add$.subscribe(console.log); * * add$.next(1); * // 1 * * add$(2) * // 2 * ``` * * #### Example: Creating a source with a type * ```typescript * const add$ = source('add$'); * ``` * * #### Example: Creating a source with onEvent naming convention * ```typescript * import { source } from '@state-adapt/rxjs'; * * const onAdd = source(); * * onAdd.subscribe(console.log); * * onAdd(1) * // 1 * ``` */ export declare function source(type?: string): SourceFn; export type SourceFn = (unknown extends T ? () => void : (payload: T) => void) & Subject;