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

Add support for disposing communicator with "await using" #3526

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

pepone
Copy link
Member

@pepone pepone commented Feb 10, 2025

Fix #3520

onwarn: (warning, next) => {
// Ignore the "this is undefined" warning, let rollup silently rewrite it.
// This avoids warnings from the TypeScript polyfills for async disposable resources.
if (warning.code === "THIS_IS_UNDEFINED") return;
Copy link
Member

Choose a reason for hiding this comment

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

Just so I understand, what is "THIS_IS_UNDEFINED" referring to? Is it [Symbol.asyncDispose] because it's a Typescript thing?

Is this the standard way to add TypeScript features through JavaScript?

Copy link
Member Author

Choose a reason for hiding this comment

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

No this is not related to Symbol.asyncDispose.

This is to avoid a rollup warning when we bundle the JavaScript code generated by TypeScript compiler.

TypeScript generates a polyfill for using await and the polyfill uses "this" in a top-level context which for ES6 is equivalent to undefined.

Copy link
Member

@externl externl left a comment

Choose a reason for hiding this comment

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

Looks good. Prettier is complaining about gulpfile.js

@pepone pepone merged commit f24e5f0 into zeroc-ice:main Feb 10, 2025
23 checks passed
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.

Add support for disposing communicator with TypeScript using keyword
3 participants