feat: version 2 beta
This commit is contained in:
32
types/common.ts
Normal file
32
types/common.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Represents an empty object.
|
||||
*/
|
||||
export type Empty = Record<string, never>;
|
||||
|
||||
/**
|
||||
* Represent an unknown object.
|
||||
*/
|
||||
export type Unknown = Record<string, unknown>;
|
||||
|
||||
/**
|
||||
* Represents a subscription that exposes a way to unsubscribe.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* function subscribe(): Subscription {
|
||||
* const interval = setInterval(() => console.log("foo"), 1000);
|
||||
* return {
|
||||
* unsubscribe() {
|
||||
* clearInterval(interval);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
export type Subscription = {
|
||||
/**
|
||||
* Gracefully terminate a decoupled subscriber.
|
||||
*/
|
||||
unsubscribe: () => void;
|
||||
};
|
||||
Reference in New Issue
Block a user