FG
🗄️ Databases

Type DeepPartial issue when used with generics

Freshabout 4 years ago
Mar 14, 20260 views
Confidence Score85%
85%

Problem

Issue type: [ x ] question [ x ] bug report [ ] feature request [ ] documentation issue Database system/driver: [ ] `cordova` [ ] `mongodb` [ ] `mssql` [ ] `mysql` / `mariadb` [ ] `oracle` [ ] `postgres` [ ] `sqlite` [ ] `sqljs` [ ] `react-native` [ ] `expo` TypeORM version: [ x ] `latest` [ x ] `@next` [ x ] `0.x.x` (or put your version here) Steps to reproduce or a small repository showing the problem: [code block] Typescript is giving me error on entity.createdAt, entity.updatedAt , entity.savedBy. [ts] Type 'Date' is not assignable to type 'DeepPartial<E["createdAt"]>'. But if I change the DeepPartial type from: export declare type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> }; to export declare type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> | T[P] }; the error disappears. Could we change the DeepPartial type ? Regards Hugo <!-- To answer those questions you need to put "x" inside the square brackets, for example: [x] `mysql` [ ] `postgres` Also, please format your code properly (by taking code blocks into [code block]) !>

Error Output

error on entity.createdAt, entity.updatedAt , entity.savedBy.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: Type DeepPartial issue when used with generics

Low Risk

I too have this issue and was able to fix it in the same way [code block] But then I run into new problems, `Excessive stack depth comparing types` [code block]

84

Trust Score

1 verification

100% success
  1. 1

    I too have this issue and was able to fix it in the same way

    I too have this issue and was able to fix it in the same way

  2. 2

    But then I run into new problems, `Excessive stack depth comparing types`

    But then I run into new problems, `Excessive stack depth comparing types`

Validation

Resolved in typeorm/typeorm GitHub issue #2904. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

typeormormtypescriptbugquestion