Skip to main content
Module

x/scaffold/src/deps/types.ts>PascalCasedPropertiesDeep

scaffold your next project with style and 💗
Latest
type alias PascalCasedPropertiesDeep
import { type PascalCasedPropertiesDeep } from "https://deno.land/x/scaffold@0.3.0/src/deps/types.ts";

Convert object properties to pascal case recursively.

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

Examples

Example 1

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

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

interface UserWithFriends {
	userInfo: User;
	userFriends: User[];
}

const result: PascalCasedPropertiesDeep<UserWithFriends> = {
	UserInfo: {
		UserId: 1,
		UserName: 'Tom',
	},
	UserFriends: [
		{
			UserId: 2,
			UserName: 'Jerry',
		},
		{
			UserId: 3,
			UserName: 'Spike',
		},
	],
};
definition: Value extends Function | Date | RegExp ? Value : Value extends Array<infer U> ? Array<PascalCasedPropertiesDeep<U>> : Value extends Set<infer U> ? Set<PascalCasedPropertiesDeep<U>> : [K in keyof Valuein keyof PascalCase<K>]: PascalCasedPropertiesDeep<Value[K]>