Skip to content

From jsonpaths to type #1

@skorfmann

Description

@skorfmann

Probably a long shot, but perhaps someone has an idea since this library is conceptually pretty close to what I'm looking for. I was trying to go from something like

{
  "id.$": "$.dynamodb.NewImage.id.S",
  "url.$": "$.dynamodb.NewImage.url.S",
  "comment.$": "$.dynamodb.NewImage.comment.S"
}

to

dynamodb: {
        NewImage: {
            id: {
                S: string;
            };
            url: {
                S: string;
            };
            comment: {
                S: string;
            };
        };
    };

with the help of chatgpt, I was getting close, but not quite to the point. Essentially ended up with something along the lines

Object literal may only specify known properties, and 'dynamodb' does not exist in type 'MergeTypes<{ "": { dynamodb: { NewImage: { id: { S: {}; }; }; }; }; }, MergeTypes<{ "": { dynamodb: { NewImage: { url: { S: {}; }; }; }; }; }, MergeTypes<{ "": { dynamodb: { NewImage: { comment: { S: {}; }; }; }; }; }, {}>>>'.ts(2353)
(property) dynamodb: {
    NewImage: {
        id: {
            S: string;
        };
        url: {
            S: string;
        };
        comment: {
            S: string;
        };
    };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions