@gqlts/cli
Version:
Generate a client sdk from your GraphQl API
12 lines (10 loc) • 420 B
text/typescript
import { RenderContext } from '../common/RenderContext';
import { getTypeMappedAlias } from './typeMappedAlias';
import { GraphQLScalarType } from 'graphql';
export function renderScalarTypes(ctx: RenderContext, types: GraphQLScalarType[]) {
let content = '';
types.forEach((type) => {
content += ` ${type.name}: ${getTypeMappedAlias(type, ctx)},\n`;
});
return `export type Scalars = {\n${content}}`;
}