fix(estree): ExportNamedDeclaration.exportKind should be type for declare export#10387
fix(estree): ExportNamedDeclaration.exportKind should be type for declare export#10387
ExportNamedDeclaration.exportKind should be type for declare export#10387Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
| const exportKind = DESER[ImportOrExportKind](POS_OFFSET.export_kind); | ||
| THIS.declaration?.declare ? 'type' : exportKind |
There was a problem hiding this comment.
| const exportKind = DESER[ImportOrExportKind](POS_OFFSET.export_kind); | |
| THIS.declaration?.declare ? 'type' : exportKind | |
| THIS.declaration?.declare ? 'type' : THIS.exportKind |
First I tried this. But this seems to generate invalid JS code as a result. 🤔
CodSpeed Instrumentation Performance ReportMerging #10387 will not alter performanceComparing Summary
|
| fn serialize<S: Serializer>(&self, serializer: S) { | ||
| if let Some(decl) = &self.0.declaration { | ||
| if decl.declare() { | ||
| ImportOrExportKind::Type.serialize(serializer); |
There was a problem hiding this comment.
I wonder whether this is a parser bug, where declared exports should be type.
There was a problem hiding this comment.
Thanks for the review.
I tried to fix parser at first, but other tests like codegen, isolated_decls failed, so I switched to this one. 😓
I will take another look at the parser side.
There was a problem hiding this comment.
I think we need to fix the parser so that consumers of this AST node knows it's a type export.
To test the theory, we can find a linter rule and double check, e.g.
I haven't checked, but we may be linting this node incorrectly.
There was a problem hiding this comment.
OK, I think I got it this time. => #10389
Since it seems that consistent-type-exports is a type-checking rule, so we don't have it yet. 👀
And other rules are not affected by exportKind.
Part of #9705