diff --git a/packages/graphql/lib/schema-builder/metadata/union.metadata.ts b/packages/graphql/lib/schema-builder/metadata/union.metadata.ts index 52faabf70..683b5ccc4 100644 --- a/packages/graphql/lib/schema-builder/metadata/union.metadata.ts +++ b/packages/graphql/lib/schema-builder/metadata/union.metadata.ts @@ -1,7 +1,7 @@ import { Type } from '@nestjs/common'; import { ResolveTypeFn } from '../../interfaces'; -export interface UnionMetadata[] = Type[]> { +export interface UnionMetadata[] = readonly Type[]> { name: string; typesFn: () => T; id?: symbol; diff --git a/packages/graphql/lib/type-factories/create-union-type.factory.ts b/packages/graphql/lib/type-factories/create-union-type.factory.ts index db94f15bb..395a52d99 100644 --- a/packages/graphql/lib/type-factories/create-union-type.factory.ts +++ b/packages/graphql/lib/type-factories/create-union-type.factory.ts @@ -13,7 +13,7 @@ import { TypeMetadataStorage } from '../schema-builder/storages/type-metadata.st /** * Interface defining options that can be passed to `createUnionType` function. */ -export interface UnionOptions[] = any[]> { +export interface UnionOptions[] = Type[]> { /** * Name of the union. */ @@ -34,13 +34,13 @@ export interface UnionOptions[] = any[]> { export type ArrayElement = ArrayType[number]; -export type Union = InstanceType>; +export type Union = InstanceType>; /** * Creates a GraphQL union type composed of types references. * @param options */ -export function createUnionType[] = any[]>( +export function createUnionType[] = Type[]>( options: UnionOptions, ): Union { const { name, description, types, resolveType } = options;