@gqlts/cli
Version:
Generate a client sdk from your GraphQl API
13 lines (10 loc) • 421 B
text/typescript
import { GraphQLScalarType } from 'graphql';
import { RenderContext } from '../common/RenderContext';
import { getTypeMappedAlias } from './typeMappedAlias';
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}}`;
}