You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
After upgrading to typescript 3.5.1 I am having issues and having to do a lot of manual casting of types.
const Users: {
user?: {
dateAdded: Date
}
} = { user: { dateAdded: new Date() } };
const userDate = idx(Users, _ => _.user.dateAdded)
if (userDate) {
new Date(userDate) // Errors - Type DeepRequiredObject<Date> is not assignable to type 'number'
}
The following will also fail:
interface UInterface {
user?: {
dateAdded: Date;
};
}
const Users: UInterface = { user: { dateAdded: new Date() } };
const userDate = idx<UInterface, Date>(Users, _ => _.user.dateAdded); // This now fails with
/*
TS2741: Property '[Symbol.toPrimitive]' is missing in type 'DeepRequiredObject<Date>' but is required in type 'Date'
*/
if (userDate) {
console.log(new Date(userDate));
}
The text was updated successfully, but these errors were encountered:
After upgrading to
typescript 3.5.1
I am having issues and having to do a lot of manual casting of types.The following will also fail:
The text was updated successfully, but these errors were encountered: