sarkistlt / mongoose-schema-to-graphql

Use Mongoose schema to generate graphQL type.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to use with TS, but get this error

Wiklem opened this issue · comments

error TS2345: Argument of type '{ name: string; description: string; class: string; schema: any; }' is not assignable to parameter of type 'ConfigurationObject'.
Types of property 'class' are incompatible.
Type 'string' is not assignable to type 'ClassFieldType'.

commented

Same here. I've fix that by change in index.d.ts (JUST QUICK FIX)

type ConfigurationObject = {
        name: string,
        description?: string,
        class: ClassFieldType,
        schema: mongoose.Schema,
        exclude?: RegExp | string[],
        extend?: ExtendFieldType,
        fields?: ObjectKeyStringValueAnyType,
    };
    type ConfigurationObject = {
        name: string,
        description?: string,
        class: string,
        schema: mongoose.Schema,
        exclude?: RegExp | string[],
        extend?: ExtendFieldType,
        fields?: ObjectKeyStringValueAnyType,
    };

should be fixed in v2.8.1

You don't resolve this problem