baconjs / bacon.js

Functional reactive programming library for TypeScript and JavaScript

Home Page:https://baconjs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ObjectTemplate type issue with Date objects

pvakevai opened this issue · comments

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

@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.

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.