tannerntannern / ts-mixer

A small TypeScript library that provides tolerable Mixin functionality.
MIT License
379 stars 27 forks source link

Does not work with decorators of "type-graphql" #62

Open mduvernon opened 1 year ago

mduvernon commented 1 year ago

Does not work with decorators of "type-graphql" Even if aplying

tannerntannern commented 1 year ago

You're going to have to be more specific. A minimal reproducible example would be helpful.

mduvernon commented 1 year ago

Let's say we have the following code snipet from "type-graphql"

` import { Field, Int, ObjectType } from 'type-graphql'; import { Mixin, decorate } from 'ts-mixer';

@ObjectType() class Foo { @decorate(Field()) fooTitle: string;

@decorate(Field(type => [Rate])) fooRatings: Rate[];

@decorate(Field({ nullable: true })) fooAverageRating?: number; }

......

@ObjectType() class Bar { @decorate(Field()) barTitle: string;

@decorate(Field(type => [Rate])) barRatings: Rate[];

@decorate(Field({ nullable: true })) barAverageRating?: number; }

@ObjectType() class MyClass extends Mixin(Foo, Bar) {} `

This code "MyClass" does not seem to apply the parent decorator "Field" properties

tannerntannern commented 1 year ago

@decorate should be used for class decorators as well as field decorators. If you make that change, does it work for you?

mduvernon commented 1 year ago

Does not work either