Skip to content

Commit

Permalink
fix: inject and optional decorators should allow key to be undefined (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
darkbasic committed Mar 22, 2023
1 parent e454a1d commit df7e2db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-bulldogs-cry.md
@@ -0,0 +1,5 @@
---
'graphql-modules': patch
---

TypeScript 5 support for the Inject and Optional decorators
7 changes: 7 additions & 0 deletions packages/graphql-modules/src/di/decorators.ts
Expand Up @@ -51,6 +51,13 @@ export function Injectable(options?: ProviderOptions): ClassDecorator {
};
}

// https://github.com/microsoft/TypeScript/issues/52435
type ParameterDecorator = (
target: Object,
propertyKey: string | symbol | undefined,
parameterIndex: number
) => void;

export function Optional(): ParameterDecorator {
return (target, _, index) => {
ensureReflect();
Expand Down

0 comments on commit df7e2db

Please sign in to comment.