Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TypeScript error TS1271: Decorator function return type is 'Record<..., unknown>' but is expected to be 'void' or 'any'. #194

@jdanyow

Description

@jdanyow

I think there's a regression in the typedefs for version 1.3.1.

TypeScript error TS1271: Decorator function return type is 'Record<..., unknown>' but is expected to be 'void' or 'any'.

https://github.com/github/catalyst/pull/190/files#diff-0609e410282ce718628c6b5977007b6a14a3edef8f178c61d749d134249ae52f

Changing the typedefs sorts it for me:

/**
 * Target is a decorator which - when assigned to a property field on the
 * class - will override that class field, turning it into a Getter which
 * returns a call to `findTarget(this, key)` where `key` is the name of the
 * property field. In other words, `@target foo` becomes a getter for
 * `findTarget(this, 'foo')`.
 */
- export declare function target<K extends string>(proto: Record<K, unknown>, key: K): Record<K, unknown>;
+ export declare function target<K extends string>(proto: Record<K, unknown>, key: K): void; 
/**
 * Targets is a decorator which - when assigned to a property field on the
 * class - will override that class field, turning it into a Getter which
 * returns a call to `findTargets(this, key)` where `key` is the name of the
 * property field. In other words, `@targets foo` becomes a getter for
 * `findTargets(this, 'foo')`.
 */
- export declare function targets<K extends string>(proto: Record<K, unknown>, key: K): Record<K, unknown>;
+ export declare function targets<K extends string>(proto: Record<K, unknown>, key: K): void;
//# sourceMappingURL=target.d.ts.map

node_modules/@github/catalyst/lib/target.d.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions