[feature request]: flat NestedJSON
Author: salisbury-espinosaCreated Sep 14, 2026Updated Sep 14, 2026
Labelstype addition
Type description + examples
type NestedJSON = {
user: {
id: number;
profile: {
firstName?: string;
lastName: string;
};
metadata: {
createdAt?: string | null;
source: string;
};
};
};
type Result = FlattenLeafs<NestedJSON>;===>
type Result = {
"user.id": number;
"user.profile.lastName": string;
"user.metadata.source": string;
"user.profile.firstName"?: string | undefined;
"user.metadata.createdAt"?: string | null | undefined;
}Type source
No response
Search existing types and issues first
- I tried my best to look for it
Source: sindresorhus/type-fest