Type alias ScreamingSnakeCase<Value>

ScreamingSnakeCase<Value>: Value extends string
    ? IsScreamingSnakeCase<Value> extends true
        ? Value
        : Uppercase<SnakeCase<Value>>
    : Value

Convert a string literal to screaming-snake-case.

This can be useful when, for example, converting a camel-cased object property to a screaming-snake-cased SQL column name.

Type Parameters

  • Value

Example

import type {ScreamingSnakeCase} from 'type-fest';

const someVariable: ScreamingSnakeCase<'fooBar'> = 'FOO_BAR';