Skip to content

Commit

Permalink
fix(cli): Fix TS warnings in custom function template (#11770)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Dec 12, 2024
1 parent 46c75ca commit 493d719
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ test('templateForComponentFile can override output path', async () => {
apiPathSection: 'functions',
generator: 'function',
templatePath: 'function.ts.template',
templateVars: { name: 'func' },
templateVars: { name: 'func', typescript: false },
outputPath: path.normalize('/path/to/project/api/src/functions/func.ts'),
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ import { logger } from 'src/lib/logger'
* @see {@link https://redwoodjs.com/docs/serverless-functions#security-considerations|Serverless Function Considerations}
* in the RedwoodJS documentation for more information.
*
* @typedef { import('aws-lambda').APIGatewayEvent } APIGatewayEvent
* @typedef { import('aws-lambda').Context } Context
* @param { APIGatewayEvent } event - an object which contains information from the invoker.
* @param { Context } _context - contains information about the invocation,
* function, and execution environment.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/generate/function/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const files = async ({
apiPathSection: 'functions',
generator: 'function',
templatePath: 'function.ts.template',
templateVars: { ...rest },
templateVars: { ...rest, typescript: generateTypescript },
outputPath: path.join(
getPaths().api.functions,
functionName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { logger } from 'src/lib/logger'
*
* @see {@link https://redwoodjs.com/docs/serverless-functions#security-considerations|Serverless Function Considerations}
* in the RedwoodJS documentation for more information.
*
*<% if (!typescript) { %>
* @typedef { import('aws-lambda').APIGatewayEvent } APIGatewayEvent
* @typedef { import('aws-lambda').Context } Context
* @typedef { import('aws-lambda').Context } Context<% } %>
* @param { APIGatewayEvent } event - an object which contains information from the invoker.
* @param { Context } _context - contains information about the invocation,
* function, and execution environment.
Expand Down

0 comments on commit 493d719

Please sign in to comment.