Skip to content

Commit

Permalink
Fix typo in OutputTypeEnhanceMap
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalLytek committed Jan 6, 2021
1 parent 7e29a74 commit dfcd4d2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
5 changes: 2 additions & 3 deletions experiments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
ModelsEnhanceMap,
applyModelsEnhanceMap,
ModelConfig,
applyOutputTypeEnhanceMap,
applyOutputTypesEnhanceMap,
OutputTypeConfig,
} from "./prisma/generated/type-graphql";
import { PrismaClient } from "./prisma/generated/client";
Expand Down Expand Up @@ -71,8 +71,7 @@ const aggregateClientConfig: OutputTypeConfig<"AggregateClient"> = {
avg: [Extensions({ complexity: 10 })],
},
};

applyOutputTypeEnhanceMap({
applyOutputTypesEnhanceMap({
AggregateClient: aggregateClientConfig,
ClientAvgAggregate: {
fields: {
Expand Down
12 changes: 6 additions & 6 deletions experiments/prisma/generated/type-graphql/enhance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,16 @@ export type OutputTypeConfig<TModel extends OutputTypesNames> = {
fields?: OutputTypeFieldsConfig<TModel>;
};

export type OutputTypeEnhanceMap = {
export type OutputTypesEnhanceMap = {
[TModel in OutputTypesNames]?: OutputTypeConfig<TModel>;
};

export function applyOutputTypeEnhanceMap(
outputTypeEnhanceMap: OutputTypeEnhanceMap,
export function applyOutputTypesEnhanceMap(
outputTypesEnhanceMap: OutputTypesEnhanceMap,
) {
for (const outputTypeEnhanceMapKey of Object.keys(outputTypeEnhanceMap)) {
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypeEnhanceMap;
const typeConfig = outputTypeEnhanceMap[outputTypeName]!;
for (const outputTypeEnhanceMapKey of Object.keys(outputTypesEnhanceMap)) {
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypesEnhanceMap;
const typeConfig = outputTypesEnhanceMap[outputTypeName]!;
const typeClass = outputTypes[outputTypeName];
const typeTarget = typeClass.prototype;
applyTypeClassEnhanceConfig(typeConfig, typeClass, typeTarget);
Expand Down
12 changes: 6 additions & 6 deletions src/generator/enhance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,16 @@ export function generateEnhanceMap(
fields?: OutputTypeFieldsConfig<TModel>;
};
export type OutputTypeEnhanceMap = {
export type OutputTypesEnhanceMap = {
[TModel in OutputTypesNames]?: OutputTypeConfig<TModel>;
};
export function applyOutputTypeEnhanceMap(
outputTypeEnhanceMap: OutputTypeEnhanceMap,
export function applyOutputTypesEnhanceMap(
outputTypesEnhanceMap: OutputTypesEnhanceMap,
) {
for (const outputTypeEnhanceMapKey of Object.keys(outputTypeEnhanceMap)) {
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypeEnhanceMap;
const typeConfig = outputTypeEnhanceMap[outputTypeName]!;
for (const outputTypeEnhanceMapKey of Object.keys(outputTypesEnhanceMap)) {
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypesEnhanceMap;
const typeConfig = outputTypesEnhanceMap[outputTypeName]!;
const typeClass = outputTypes[outputTypeName];
const typeTarget = typeClass.prototype;
applyTypeClassEnhanceConfig(typeConfig, typeClass, typeTarget);
Expand Down
12 changes: 6 additions & 6 deletions tests/regression/__snapshots__/enhance.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ export type OutputTypeConfig<TModel extends OutputTypesNames> = {
fields?: OutputTypeFieldsConfig<TModel>;
};
export type OutputTypeEnhanceMap = {
export type OutputTypesEnhanceMap = {
[TModel in OutputTypesNames]?: OutputTypeConfig<TModel>;
};
export function applyOutputTypeEnhanceMap(
outputTypeEnhanceMap: OutputTypeEnhanceMap,
export function applyOutputTypesEnhanceMap(
outputTypesEnhanceMap: OutputTypesEnhanceMap,
) {
for (const outputTypeEnhanceMapKey of Object.keys(outputTypeEnhanceMap)) {
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypeEnhanceMap;
const typeConfig = outputTypeEnhanceMap[outputTypeName]!;
for (const outputTypeEnhanceMapKey of Object.keys(outputTypesEnhanceMap)) {
const outputTypeName = outputTypeEnhanceMapKey as keyof typeof outputTypesEnhanceMap;
const typeConfig = outputTypesEnhanceMap[outputTypeName]!;
const typeClass = outputTypes[outputTypeName];
const typeTarget = typeClass.prototype;
applyTypeClassEnhanceConfig(typeConfig, typeClass, typeTarget);
Expand Down

0 comments on commit dfcd4d2

Please sign in to comment.