Go to repository

Type Alias Paths<T>

Paths<T>: T extends object
    ? {
        [K in keyof T]: `${Exclude<K, symbol>}${"" | `.${Paths<T[K]>}`}`
    }[keyof T]
    : never

This type represent all the possible paths of an object type.

Type Parameters

  • T

A path consists of a path that leads to a simple or complex value. So for example let' say we have an object with the form { foo: { bar: 5, baz: 'hello' } }, then the Paths of it's type are foo, foo.bar and foo.baz.

This type is useful if you need to type things such as paths in an object that lead to a particular value, such as the types of a translation in a json file.