Skip to content

keyof

type keyof<'T> =
    | Value__ of string
AssemblyXantham.Fable.Core

Get a property key from a mapping function for the given type.

type Book<'T> = { Title: keyof<'T> }
type LibraryHires = {
Witcher: int
Dune: int
}
let makeBook (key: keyof<LibraryHires>): Book<LibraryHires> = {
Title = key
}
let dune = makeBook (keyof<_, _> _.Dune)
dune.Title.Value // "Dune"

Cases

Value__ of string

Properties

member inline Value: string

Methods

static member inline UnsafeCastFrom<'T> (value: keyof<obj>) : keyof<'T>
static member inline UnsafeCastReturnType<'ReturnType> (key: keyof<'T>) : typekeyof<'T,'ReturnType>
static member inline op_Implicit<'a> (key: typekeyof<'T,'a>) : keyof<'T>