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

Add support for array to "typeorm-typescript/enforce-column-types" #3

Closed
SimonSimCity opened this issue May 21, 2024 · 4 comments
Closed

Comments

@SimonSimCity
Copy link

The rule currently reports at a property defined as:

@Entity('data_points')
export class DataPoint {
  @Column({ type: 'text', name: 'linked_persons', nullable: true, array: true })
  linkedPersons?: string[] | null;
}

... and provides the option to change the type of linkedPerson to string | null, which is wrong, because I have the option array enabled. See https://typeorm.io/entities#column-options

It should not report on this column. It should instead report on this property, where the property array is enabled, but the type is no array:

@Entity('data_points')
export class DataPoint {
  @Column({ type: 'text', name: 'linked_persons', nullable: true, array: true })
  linkedPersons?: string | null;
}
@daniel7grant
Copy link
Owner

Thanks for using the library! I'm not a TypeORM power user, so I don't know all of the @Column options. I'll add an extra check for the array field, to handle this case.

@daniel7grant
Copy link
Owner

I added support for the array type in v0.2.6. Can you try if this solves your problem?

@abd-almofleh
Copy link

@daniel7grant Yes it does, Thanks for the quick update

@SimonSimCity
Copy link
Author

SimonSimCity commented Jun 12, 2024

I, too, can confirm this working.

I can fully understand that you built the library for what was needed at the time, and the more appreciate you taking the time to help extending it for my use-case. Thanks very much for the quick update 🎉

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