All files / src/generate common.ts

50% Statements 4/8
100% Branches 0/0
0% Functions 0/4
66.67% Lines 4/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 122x     2x 2x   2x          
import { validationToType } from 'yaschva'
import { OutputSuccess } from '../transform/types.js'
 
export const capitalize = (s: string) => s.charAt(0).toUpperCase() + s.slice(1)
export const name = (x: OutputSuccess): string => `${x.name}${capitalize(x.method)}`
 
export const typeDef = (contracts: OutputSuccess[]): string =>
  contracts.map(x =>
    `/** ${x.name} types for ${x.method} method **/
export type ${name(x)}Argument = ${validationToType(x.arguments)}
export type ${name(x)}Returns = ${validationToType(x.returns)}\n`).join('\n')