MichalLytek / MichalLytek/type-graphql

Preconfigured decorators aliases

Open
#577 0 comments 3 reactions 0 assignees View on GitHub
Enhancement :new:
Dominant language
TypeScript
Stars
8.1k
Forks
672
PR merge metrics
No merged PRs in 30d

Description

This feature is kind partial apply equivalent from functional programming paradigm.

It gives you an ability to create decorators that have some options binded,
like `@NullableField() === @Field({ nullable: true })`:

```ts
const NullableField = createDecoratorAlias(Field, { nullable: true });
const AbstractResolver = createDecoratorAlias(Resolver, { isAbstract: true });
const IntField = createDecoratorAlias(Field, type => Int);
```

This might help to avoid common boilerplate and also can be useful for other libraries integration purposes.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by examining the existing Field and Resolver decorators and the proposed createDecoratorAlias entry point; determine how aliases should bind options and how the IntField example differs. Done should support the NullableField, AbstractResolver, and IntField use cases without changing existing decorator behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.