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

fix: Fix this error: Type 'T' does not satisfy the constraint 'ObjectLiteral' #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SuzGori
Copy link

@SuzGori SuzGori commented Jul 14, 2023

#17

@SuzGori SuzGori changed the title fix: Fix this error: Type 'T' does not satisfy the constraint 'ObjectLiteralL' fix: Fix this error: Type 'T' does not satisfy the constraint 'ObjectLiteral' Jul 14, 2023
@@ -51,7 +51,7 @@ interface IAllowedRelation {
allowedColumns: string[];
}

export class TypeOrmCrudService<T> extends CrudService<T, DeepPartial<T>> {
export class TypeOrmCrudService<T extends ObjectLiteral> extends CrudService<T, DeepPartial<T>> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it's for TypeORM why not extend from BaseEntity?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tonydspaniard BaseEntity is not a good candidate for this extend as it is only applicable when using the ActiveRecord pattern and plenty of people use the DataMapper.

See https://typeorm.io/active-record-data-mapper

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

Successfully merging this pull request may close these issues.

3 participants