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 /** @deferred */ comments to deferred callback parameters #1757

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ahejlsberg
Copy link
Member

This PR adds /** @deferred */ comments to deferred callback parameters in preparation for microsoft/TypeScript#58729.

Copy link
Contributor

Thanks for the PR!

This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged.

@saschanaz
Copy link
Contributor

You also need to npm run build && npm run baseline-accept.

@saschanaz
Copy link
Contributor

saschanaz commented Jul 15, 2024

(Looks good. feel free to merge when the TS PR is ready)

@saschanaz
Copy link
Contributor

saschanaz commented Jul 15, 2024

One question, why not use deferred modifier when we are using TypeScript here? (Edit: Oh, for backward compat, cool.)

@saschanaz
Copy link
Contributor

And another question, is it the requirement here for the callback to be called asynchronously? What happens if those callbacks can be called both sync/async?

@ahejlsberg
Copy link
Member Author

ahejlsberg commented Jul 15, 2024

And another question, is it the requirement here for the callback to be called asynchronously?

The deferred modifier (and the /** @deferred */ JSDoc comment) asserts that the callback is never called synchronously. If a synchronous call is a possibility, then the parameter shouldn't have the modifier.

BTW, I haven't been able to find any authoritative documentation on sync vs. async for the various DOM callbacks, so it could well be that some of the modifiers shouldn't be present.

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.

2 participants