Type Alias SnakeCasedProperties<Value>

SnakeCasedProperties: DelimiterCasedProperties<Value, "_">

Convert object properties to snake case but not recursively.

This can be useful when, for example, converting some API types from a different style.

Type Parameters

  • Value
  • SnakeCase
  • SnakeCasedPropertiesDeep
import type {SnakeCasedProperties} from 'type-fest';

interface User {
userId: number;
userName: string;
}

const result: SnakeCasedProperties<User> = {
user_id: 1,
user_name: 'Tom',
};