Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typewriter): export property is ignored for FreeFunctions #1079

Closed
wants to merge 2 commits into from

Conversation

colifran
Copy link
Contributor

The export property is ignored when rendering a FreeFunction. We currently just render the FreeFunction without considering if the function should be exported:

This PR updates the renderFunction function to accept a FreeFunction type allowing us to check the value of the export property. If export is true then an export modifier is added in front of the function definition.

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Copy link

@aws-cdk/aws-service-spec: No model change detected

@@ -411,11 +411,11 @@ export class TypeScriptRenderer extends Renderer {
throw new Error(`Symbol ${sym} (in ${sym.scope}) not visible from ${this.scopes[0]} (missing import?)`);
}

protected renderFunction(func: CallableDeclaration) {
protected renderFunction(func: FreeFunction) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface change makes be a little anxious. Are you sure this won't cause any issues?
renderFunction is protected, so we should be able to reason about this question from the code paths.

@mrgrain mrgrain disabled auto-merge May 10, 2024 09:29
Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but unqueued, so you can have a look at my comment. Looks good otherwise.

@colifran colifran closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants