Skip to content

Wrong remapping of nested arrays #57

Description

@Goldziher

Hi there,

Given the following type:

interface ChatRequestBody {
	drive_id: string;
	user_query: string;
	session_id: string;
	folders: ('PRE' | 'VDR' | 'AUDIT' | 'POST')[];
}

The folders value gets remapped wrongly when applied with Camelize.

expected type CamelizeChatRequestBody = Camelize<ChatRequestBody> to be equal to this:

type CamelizeChatRequestBody = {
	driveId: string;
	userQuery: string;
	sessionId: string;
	folders: ('PRE' | 'VDR' | 'AUDIT' | 'POST')[];
}

But its actually equal to this:

type CamelizeChatRequestBody = {
	driveId: string;
	userQuery: string;
	sessionId: string;
	folders: 'PRE'[] | 'VDR'[] | 'AUDIT'[] | 'POST'[];
}

I therefore need to do something like this:

type CamelizeChatRequestBody = Camelize<Omit<ChatRequestBody, "folders>> & { folders: ('PRE' | 'VDR' | 'AUDIT' | 'POST')[] }

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