Skip to content

Commit

Permalink
Make the possibleTypes variable a const to be able to pull out a type…
Browse files Browse the repository at this point in the history
… from the values (#6)
  • Loading branch information
chr1sjf0x authored Jan 7, 2021
1 parent 4057f17 commit c845430
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integration/graphql-types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const possibleTypes = {
HasName: ["Author", "Book"],
};
} as const;
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PluginFunction, Types } from "@graphql-codegen/plugin-helpers";
import { GraphQLObjectType } from "graphql";
import { code } from "ts-poet";
import { PluginFunction, Types } from "@graphql-codegen/plugin-helpers";
import PluginOutput = Types.PluginOutput;

/** Generates a `possibleTypes` config object for apollo. */
Expand All @@ -23,7 +23,7 @@ export const plugin: PluginFunction<{}> = async schema => {
${Object.entries(interfaceImpls).map(([name, impls]) => {
return `${name}: [${impls.map(n => `"${n}"`).join(", ")}],`;
})}
};
} as const;
`.toStringWithImports();
return { content } as PluginOutput;
};

0 comments on commit c845430

Please sign in to comment.