Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "Object/Invert"

Index

Type aliases

Type aliases

Invert

Invert<O>: Compute<IntersectOf<{ [K in keyof O]: { [P in O[K]]: K; }; }[keyof O]>>

Swaps the keys and values of an object (if applicable)

Type parameters

returns

object

example

import {O} from 'ts-toolbelt'

enum E {
    A = 'Av',
    B = 'Bv',
    C = 'Cv',
    D = 'Dv',
    X = 1
}

type O = {
    A: 'Av'
    B: 'Bv'
    C: 'Cv'
    D: 'Dv'
    X: 1
}

type test0 = O.Invert<typeof E>
type test1 = O.Invert<O>

Made with ❤️ by pirix-gh. Documentation generated by TypeDoc.