WatermelonDB icon indicating copy to clipboard operation
WatermelonDB copied to clipboard

type error with text and field

Open mhuangwm opened this issue 1 year ago • 3 comments

Hi, I'm getting a typescript error with text and field

import { field, text,  } from '@nozbe/watermelondb/decorators'

@text('name') name
@field('sortOrder') sortOrder
Unable to resolve signature of property decorator when called as an expression.

Following https://github.com/Nozbe/WatermelonDB/issues/559, should I just put export type PropertyDecorator = any into /decorators/text/index.d.ts and /decorators/field/index.d.ts?

mhuangwm avatar Oct 01 '23 01:10 mhuangwm

I also have the issue

whwnow avatar Nov 19 '23 16:11 whwnow

Looks like "experimentalDecorators": true in the tsconfig.json works for me. https://www.typescriptlang.org/tsconfig#experimentalDecorators Not sure about the long term effect - cause this is support for stage3 TC39 decorators, not the legacy ones.

dmitrybirin avatar Jan 24 '24 11:01 dmitrybirin

^ That fixed it for me as well.

coolsoftwaretyler avatar Jul 22 '24 19:07 coolsoftwaretyler