Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: update Entity decorator return type to ClassDecorator (#5776)
I've been making a class decorator composer function, and Function type is not specific enough. I'll augment it locally for the time being.

I suppose some other types would have to be updated as well, hopefully there's a CI in place
  • Loading branch information
GrayStrider committed May 16, 2020
1 parent 1829f96 commit 7d8a1ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/decorator/entity/Entity.ts
Expand Up @@ -5,23 +5,23 @@ import {TableMetadataArgs} from "../../metadata-args/TableMetadataArgs";
* This decorator is used to mark classes that will be an entity (table or document depend on database type).
* Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.
*/
export function Entity(options?: EntityOptions): Function;
export function Entity(options?: EntityOptions): ClassDecorator;

/**
* This decorator is used to mark classes that will be an entity (table or document depend on database type).
* Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.
*/
export function Entity(name?: string, options?: EntityOptions): Function;
export function Entity(name?: string, options?: EntityOptions): ClassDecorator;

/**
* This decorator is used to mark classes that will be an entity (table or document depend on database type).
* Database schema will be created for all classes decorated with it, and Repository can be retrieved and used for it.
*/
export function Entity(nameOrOptions?: string|EntityOptions, maybeOptions?: EntityOptions): Function {
export function Entity(nameOrOptions?: string|EntityOptions, maybeOptions?: EntityOptions): ClassDecorator {
const options = (typeof nameOrOptions === "object" ? nameOrOptions as EntityOptions : maybeOptions) || {};
const name = typeof nameOrOptions === "string" ? nameOrOptions : options.name;

return function (target: Function) {
return function (target) {
getMetadataArgsStorage().tables.push({
target: target,
name: name,
Expand Down

0 comments on commit 7d8a1ca

Please sign in to comment.