0

I'm receiving the following error with a simple example using class-transformer.

error TS1240: Unable to resolve signature of property decorator when called as an expression.
Argument of type 'ClassFieldDecoratorContext<Root, Project[]> & { name: "Projects"; private: false; static: false; }' is not assignable to parameter of type 'string | symbol'.

Here's my example:

import 'reflect-metadata';
import { Type, plainToClass } from 'class-transformer';

class Project {
    ProjectName: string;
    ProjectDisplayName: string;
}

class Root {
    @Type(() => Project) // <- error here 
    Projects: Array<Project>;
}

function greeter(person: string) {
    return `Hello ${person}!`;
}

const greeterName = 'Node Hero'

console.log(greeter(greeterName));

I'm not sure how to proceed.

Danno
  • 933
  • 4
  • 13
  • 30
  • After receiving this same error message from several different libraries which use decorators, I discovered that it's due to TypeScript 5.0 having changed the signature for decorators. – Danno Aug 04 '23 at 13:27

0 Answers0