Learn more  » Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

skava / chain-able-deps   js

Repository URL to install this package:

Version: 6.0.4 

/ src / _typings / index.ts

export * from './Serializable'
export * from './typeof'
export * from './times'
export * from './slice'
export * from './FantasyLand'
export * from './helpers'
export * from './generic'

import { AnyObj, AnyArray, AnyArrayOrObj, SafePrimitive } from './Serializable'
export type Sizable =
  | Set<any>
  | Map<any, any>
  | AnyObj
  | AnyArray
  | number
  | string
  | null
  | undefined
export type AnyCollection = Set<any> | Map<any, any>
export interface Always<Type> extends Function {
  (...ignored: any[]): Type
  (): Type
}

export type Constructor<T = {}> = new (...args: any[]) => T
export type Class = Constructor

export interface ArgumentPooler {
  <This>(copyFieldsFrom: any): This
}

export interface PooledInstance<T = any, Args = any[]> {
  new (...args: Args[]): PooledInstance
  call?(instance: T, ...args: any[]): T
  construct?(...args: any[]): T | PooledClass<any>
  destructor(): void
}
export interface PooledClass<T = any, Args = any>
  extends PooledInstance<T, Args> {
  new (...args: Args[]): PooledClass
  instancePool: PooledClass[]
  getPooled(...args: Args[]): any
  poolSize: number
  release(pooled): void
}

export interface PoolReleaser extends Function {}

export interface Predicate<Type = any> {
  (x: Type): boolean
}

// export interface ObjWithKeyValue<Key, Value> {
//   [key: keyof Key]: Value
// }
// type ObjWithValue<Obj> = {
//   [P in keyof Obj]?: Obj[P];
// }
// type ObjWithValue<Key, Value> = {
//   [P in keyof Key]?: (Value & Key)[P];
// }
// { [s: string]: T } | ArrayLike<T>):
// type ArrayWithValue<Obj> = {
//   [P in keyof Obj]?: Obj[P];
// } & Array<Obj>

// const eh: ObjWithValue<[string, boolean][]> = []
// eh[0] = 1
// const eh: ObjWithValue<[string, boolean][]> = {
//   eh: true,
//   meh: true,
//   number: 1,
// }

// const eh: ObjWithValue<{eh: true}> = {
//   eh: true,
//   meh: true,
// }

export interface ObjWith<Key = any, Value = any> {
  [key: string]: Value
}

export type Real = AnyArrayOrObj | SafePrimitive
export type Empty = {} | EmptyArray | '' | EmptySet | EmptyMap
export type EmptyOrUnsafe = Empty | undefined | null

export interface EmptyMap<Key = string, Value = any> extends Map<Key, Value> {
  size: 0
}
export interface EmptySet<Value = any> extends Set<Value> {
  size: 0
}
export interface EmptyArray<Value = any> extends Array<Value> {
  length: 0
}