Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 26x 26x 26x 28x 26x | import { AutoClose, AutoCloseMany, AutoCloseOne, AutoCloseType } from "@jonloucks/contracts-ts/api/AutoClose";
import { Contract } from "@jonloucks/contracts-ts/api/Contract";
import { create as createContract } from "@jonloucks/contracts-ts/api/RatifiedContract";
import { guardFunctions, RequiredType } from "@jonloucks/contracts-ts/api/Types";
/**
* Interface for a factory that creates AutoClose instances.
*/
export interface AutoCloseFactory {
/**
* Create an AutoClose for a given closeable resource.
* @param type the closeable resource
* @returns the AutoClose instance
*/
createAutoClose(type: RequiredType<AutoCloseType>): RequiredType<AutoClose>;
/**
* Create an AutoCloseMany instance for managing multiple closeable resources.
*
* @returns the AutoCloseMany instance
*/
createAutoCloseMany(): RequiredType<AutoCloseMany>;
/**
* Create an AutoCloseOne instance for managing a single closeable resource.
*
* @returns the AutoCloseOne instance
*/
createAutoCloseOne(): RequiredType<AutoCloseOne>;
}
export { AutoClose, AutoCloseMany, AutoCloseOne, AutoCloseType } from "@jonloucks/contracts-ts/api/AutoClose";
export { Contract } from "@jonloucks/contracts-ts/api/Contract";
export { OptionalType, RequiredType } from "@jonloucks/contracts-ts/api/Types";
/**
* Type guard for AutoCloseFactory interface.
*
* @param instance the instance to check
* @returns true if the instance implements AutoCloseFactory
*/
export function guard(instance: unknown): instance is RequiredType<AutoCloseFactory> {
return guardFunctions(instance, 'createAutoClose', 'createAutoCloseMany', 'createAutoCloseOne');
}
/**
* The Contract for AutoCloseFactory implementation.
*/
export const CONTRACT: Contract<AutoCloseFactory> = createContract({
test: guard,
name: "AutoCloseFactory",
typeName: "AutoCloseFactory"
});
|