UNPKG

a2r

Version:
15 lines (14 loc) 588 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const getProxyMethod = (key, methodName, paramNodes, returnTypeInfo) => { const params = [ ...paramNodes.map((n) => n.getFullText().trim()), 'ctx?: GetServerSidePropsContext', ]; const wrapperParams = [ ...paramNodes.map((n) => n.getChildAt(0).getFullText().trim()), 'ctx', ]; return `const ${methodName} = (${params.join(', ')}): Promise<${returnTypeInfo.type}> => methodWrapper('${key}', ${wrapperParams.join(', ')});`; }; exports.default = getProxyMethod;