Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong remapping of nested arrays #57

Open
Goldziher opened this issue Jun 20, 2024 · 0 comments
Open

Wrong remapping of nested arrays #57

Goldziher opened this issue Jun 20, 2024 · 0 comments

Comments

@Goldziher
Copy link

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')[] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant