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

ObjectTemplate type issue with Date objects #806

Open
pvakevai opened this issue Jan 12, 2023 · 2 comments
Open

ObjectTemplate type issue with Date objects #806

pvakevai opened this issue Jan 12, 2023 · 2 comments

Comments

@pvakevai
Copy link

ObjectTemplate type mappings are wrong, combining a template with a field of type Date will not be typed correctly. See

Screenshot 2023-01-12 at 11 22 40

@kaisellgren
Copy link

kaisellgren commented Jan 12, 2023

@raimohanska
The issue lies within:

export declare type ObjectTemplate<O> = {
    [K in keyof O]: O[K] extends Observable<infer I> ? I : (O[K] extends Record<any, any> ? ObjectTemplate<O[K]> : (O[K] extends Array<infer I2> ? ArrayTemplate<I2> : O[K]));
};

This should include a separate check for Date. Right now the check O[K] extends Record<any, any> matches Date objects.

@raimohanska
Copy link
Contributor

Drop a pull request if you want this fixed. I honestly haven’t touched the library for a long time but I believe a fix release can be made for this.

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

3 participants