How to use the graphql-schema-typescript.generateTypeScriptTypes function in graphql-schema-typescript

To help you get started, we’ve selected a few graphql-schema-typescript examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goemonjs / goemon / scripts / gen-gtypes-directly.ts View on Github external
const generateGTypes = (schemaDir: string, outputPath: string) => {
  const schemasPath = glob.sync(schemaDir + '/*.+(js|ts|jsx|tsx)');
  let typeDefs: string[] = [];
  schemasPath.forEach(function (schema) {
    typeDefs.push(require(schema));
  });

  const executableSchema = makeExecutableSchema({ typeDefs });
  const options: GenerateTypescriptOptions = {
    typePrefix: '',
    noStringEnum: true,
    smartTResult: true,
    asyncResult: true
  };

  return generateTypeScriptTypes(executableSchema, outputPath, options);
};

graphql-schema-typescript

Generate TypeScript from GraphQL's schema type definitions

MIT
Latest version published 7 months ago

Package Health Score

61 / 100
Full package analysis