Skip to content

Typescript definition #26

@aravantv

Description

@aravantv

Hi,

would be great to have a typescript definition file.
I think it's hard to make it perfect due to the fact that cyclejs tries to be stream-library independent (entailing no one-type for streams), but at least a pragmatic typing which would just prevent having "unknown module" errors when using collections.

The following one could be a basis I believe:

export declare type Component<So, Si> = (sources: So, ...rest: Array<any>) => Si;

export declare interface Collection {
  <So, Si, StreamSi> (component: Component<So, Si>, sources?: So, add$?: StreamSi, remove$?: (item: Component<So, Si>) => any): Component<So, Si>;
  pluck (items$: any, f: (item: any) => any) : any;
}

export declare const Collection: Collection;
export default Collection

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions