Options
All
  • Public
  • Public/Protected
  • All
Menu

@erkobridee/ts-definitions-common

Index

Type aliases

TArrayFilter

TArrayFilter<Item>: (item: Item) => boolean

Type parameters

  • Item

Type declaration

    • (item: Item): boolean
    • describe a function used on the Array.filter

      Parameters

      • item: Item

      Returns boolean

TCallback

TCallback<Tuple, Return>: TFunction<Tuple, Return> | TEmptyCallback

describes any function that could be a TFunction or TEmptyCallback

Type parameters

  • Tuple: unknown[] = unknown[]

  • Return = unknown

TDOMElement

TDOMElement: HTMLElement | Document | Window

TDOMEventHandler

TDOMEventHandler<EventType>: TFunction<[EventType], void>

function type that will be assigned to an event listerner of any DOM element

example
const clickHandler: TDOMEventHandler = (event) => console.log(event);

window.addEventListener('click', clickHandler);

Type parameters

  • EventType: Event = Event

TEmptyCallback

TEmptyCallback: () => void

Type declaration

    • (): void
    • describes any function that doesn't have parameters and doesn't return nothing

      Returns void

TFunction

TFunction<Tuple, Return>: (...args: Tuple) => Return

Type parameters

  • Tuple: unknown[] = unknown[]

  • Return = unknown

Type declaration

    • (...args: Tuple): Return
    • describes any type of function, that could or not have parameters and return

      Parameters

      • Rest ...args: Tuple

      Returns Return

TJSObject

TJSObject<T>: Record<string, T>

JavaScript Object type

Type parameters

  • T = unknown

TJSValue

TJSValue<T>: TJSObject<T> | unknown

JavaScript value that could be an object or any other js value

Type parameters

  • T = unknown

TPropType

TPropType<TObj, TProp>: TObj[TProp]

a typescript helper to easy get which is the type of a Object property

Type parameters

  • TObj

  • TProp: keyof TObj

TTypeCallback

TTypeCallback<Return, Options>: (options?: Options) => Return

Type parameters

  • Return

  • Options = unknown

Type declaration

    • (options?: Options): Return
    • describes any function that could receive options params and should return a value

      Parameters

      • Optional options: Options

      Returns Return

TWindow

TWindow: typeof window

Variables

APP_URL

APP_URL: string = ...

get the current URL from the web application

NOTE: it will be empty if it's executed on the server side

DEFAULT_PAGE_SIZE

DEFAULT_PAGE_SIZE: 25 = 25

DEFAULT_WAIT_MILLISECONDS

DEFAULT_WAIT_MILLISECONDS: 300 = 300

FALSY

FALSY: RegExp = ...

regular expression to check a false value

expression: /^(?:f(?:alse)?|no?|off|0)$/i

false values: f, false, no, off, 0

example

FALSY.test(0) //true

TRUTHY

TRUTHY: RegExp = ...

regular expression to check a true value

expression: /^(?:t(?:rue)?|y(?:es)?|on|1)$/i

truthy values: t, true, y, yes, on, 1

example

TRUTHY.test(1) //true

hasCssVariablesSupport

hasCssVariablesSupport: boolean = ...

cache the result of window.CSS.supports('(--a: 0)')

isBrowser

isBrowser: boolean = ...

useful to avoid some code execution on Server Side Rendering

check: typeof window !== 'undefined';

m_constants_name

m_constants_name: "constants" = 'constants'

m_enums_name

m_enums_name: "enums" = 'enums'

m_interfaces_name

m_interfaces_name: "interfaces" = 'interfaces'

m_types_name

m_types_name: "types" = 'types'

Functions

Const NOOP

  • NOOP(): undefined
  • useful to define a default callback that doesn't do nothing

    Returns undefined

Const TO_STRING

  • TO_STRING(value: any): string
  • get the type name of the JS Object

    example

    TO_STRING(1); // [object Number]

    example

    TO_STRING(/x/); // [object RegExp]

    Parameters

    • value: any

    Returns string

    string - type of the Object

Generated using TypeDoc