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

feat: allow free function exports in typewriter #1379

Merged
merged 22 commits into from
Oct 25, 2024

Conversation

comcalvi
Copy link
Contributor

Typewriter does not allow free functions to be exported today. This PR enables exporting free functions.

Required for aws/aws-cdk#31850.

@comcalvi comcalvi changed the title feat (typewriter): allow free function exports feat: allow free function exports in typewriter Oct 22, 2024
@@ -411,11 +411,10 @@ 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: CallableDeclaration & TypeDeclaration) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is correct, we want to accept all CallableDeclarations not, just the ones that are also a TypeDeclaration.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we keep the signature as it is.

Then w can have a guard isExported(x): is { exported: true } { ... } to check if exported exists and is true.

Copy link

github-actions bot commented Oct 25, 2024

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

/**
* Whether this type is being exported from its scope
*/
public get export() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Now we have two things that do the same. I rather have 2 different interface.

@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Oct 25, 2024
Merged via the queue into main with commit 83ec1c3 Oct 25, 2024
8 checks passed
@aws-cdk-automation aws-cdk-automation deleted the comcalvi/function-exports branch October 25, 2024 19:40
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.

3 participants