question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"@field" decorator give an type error

See original GitHub issue

After update 0.15.0 the “field” decorator started to give an error in typescrip.

Unable to resolve signature of property decorator when called as an expression.
  This expression is not callable.
    Not all constituents of type 'Object | RawDecorator' are callable.
      Type 'Object' has no call signatures.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
ospfrancocommented, Nov 12, 2019

nvm ended up using patch-package to modify the types, in /utils/common/makeDecorator/index.d.ts:

declare module '@nozbe/watermelondb/utils/common/makeDecorator' {
  import { ReplaceReturn } from '@nozbe/watermelondb/utils/common';

  export type Descriptor = any;
  export type RawDecorator = (
    target: Object,
    key: string,
    descriptor: Descriptor,
  ) => Descriptor;
  export type RawDecoratorFactory<T extends any[]> = (
    ...any: T
  ) => RawDecorator;

  export type Decorator<
    Args extends any[],
    Factory extends RawDecoratorFactory<Args>
    // TODO: fix
  > = any;

  export default function makeDecorator<
    Args extends any[],
    T extends RawDecoratorFactory<Args>
  >(): Decorator<Args, T>;
}
0reactions
shiunducommented, Feb 26, 2020

I also have the issue, it is caused by the fact that the Descriptor of the makeDecorator is mapped to Object, I managed to resolve that by changing the Descriptor definition to:

export type Descriptor = any

in /utils/common/makeDecorator/index.d.ts

was this fix merged?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Decorated field gives read only error in TypeScript
The decorator itself is the function with the signature (target: object, propertyKey: string, descriptor: PropertyDescriptor) => ...
Read more >
Error Handling in Python using Decorators - GeeksforGeeks
Decorators in Python is one of the most useful concepts supported by Python. ... print ( "wrong data types. enter numeric" ).
Read more >
Documentation - Decorators - TypeScript
A Decorator is a special kind of declaration that can be attached to a class declaration, method, accessor, property, or parameter. Decorators use...
Read more >
Primer on Python Decorators
Decorators provide a simple syntax for calling higher-order functions. ... in <module> TypeError: wrapper_do_twice() takes 0 positional arguments but 1 was ...
Read more >
Error Handling · Goa :: Design first.
invalid_length : error produced code when the value of a payload field does not match the length validation defined in the design. Overridding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found