Skip to content

docs(ast): fix docs for ExportSpecifier#10891

Merged
graphite-app[bot] merged 1 commit intomainfrom
05-08-docs_ast_fix_docs_for_exportspecifier_
May 12, 2025
Merged

docs(ast): fix docs for ExportSpecifier#10891
graphite-app[bot] merged 1 commit intomainfrom
05-08-docs_ast_fix_docs_for_exportspecifier_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 8, 2025

The code examples were incorrect previously.

@github-actions github-actions bot added A-ast Area - AST C-docs Category - Documentation. Related to user-facing or internal documentation labels May 8, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@overlookmotel overlookmotel marked this pull request as ready for review May 8, 2025 12:02
@codspeed-hq
Copy link

codspeed-hq bot commented May 8, 2025

CodSpeed Instrumentation Performance Report

Merging #10891 will not alter performance

Comparing 05-08-docs_ast_fix_docs_for_exportspecifier_ (206e07d) with main (6f3f9d7)

Summary

✅ 36 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as draft May 8, 2025 12:08
@overlookmotel
Copy link
Member Author

overlookmotel commented May 8, 2025

@Dunqing Can I ask for your help with this one?

In this example, export_kind on the ExportNamedDeclaration is ImportOrExportKind::Type, but export_kind on the ExportSpecifier is ImportOrExportKind::Value:

export type { Foo as Bar };

That aligns with TS-ESLint. But it seems weird, because I assume the type keyword applies to all the ExportSpecifiers?

AST explorer

Either way, if you could please confirm what's intended behavior, I'll update this PR to document it (for the benefit of TS newbies like me!).

@camc314
Copy link
Contributor

camc314 commented May 10, 2025

@overlookmotel i think these two are relevant to your question:
#10473
#10465 (comment)

@Dunqing
Copy link
Member

Dunqing commented May 11, 2025

@Dunqing Can I ask for your help with this one?

In this example, export_kind on the ExportNamedDeclaration is ImportOrExportKind::Type, but export_kind on the ExportSpecifier is ImportOrExportKind::Value:

export type { Foo as Bar };

That aligns with TS-ESLint. But it seems weird, because I assume the type keyword applies to all the ExportSpecifiers?

AST explorer

Either way, if you could please confirm what's intended behavior, I'll update this PR to document it (for the benefit of TS newbies like me!).

I just realized we couldn't set ImportOrExportKind::Type for ExportSpecifier, because it will break codegen. We should print the code as-is, see TypeScript and switch to .D.TS output. So the current behavior is correct, in terms of semantics, indeed, the child ExportSpecifier is type, though.

@overlookmotel overlookmotel force-pushed the 05-08-docs_ast_fix_docs_for_exportspecifier_ branch from e9a7ea4 to d030838 Compare May 12, 2025 14:51
@overlookmotel overlookmotel marked this pull request as ready for review May 12, 2025 14:51
@overlookmotel overlookmotel requested review from Dunqing and camc314 May 12, 2025 14:51
@overlookmotel
Copy link
Member Author

overlookmotel commented May 12, 2025

Thanks both for patiently explaining to this TS noob.

I've updated the comment to (I think) explain what the export_kind field represents here. Could one of you please give it a quick check and make sure I have it right?

Edit: Cam is too fast! He's already reviewed in the time it took me to write this comment. Thank you.

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label May 12, 2025
Copy link
Member Author

overlookmotel commented May 12, 2025

Merge activity

@overlookmotel overlookmotel removed the request for review from Dunqing May 12, 2025 14:55
The code examples were incorrect previously.
@graphite-app graphite-app bot force-pushed the 05-08-docs_ast_fix_docs_for_exportspecifier_ branch from d030838 to 206e07d Compare May 12, 2025 15:25
@graphite-app graphite-app bot merged commit 206e07d into main May 12, 2025
25 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 12, 2025
@graphite-app graphite-app bot deleted the 05-08-docs_ast_fix_docs_for_exportspecifier_ branch May 12, 2025 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-docs Category - Documentation. Related to user-facing or internal documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants