Skip to content

Conversation

nikeokoronkwo
Copy link
Collaborator

@nikeokoronkwo nikeokoronkwo commented Aug 19, 2025

Fixes #424
Fixes #431

This PR adds support for TypeScript Modules, as well as TS Preprocessing, reference modules, and more!

Copy link
Contributor

@srujzs srujzs left a comment

Choose a reason for hiding this comment

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

This is a draft, so some of my comments may not apply. :)

Set<TSNode> get nodes;

final Set<ParentDeclaration> namespaceDeclarations;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this not be Set<NamespaceDeclaration>?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

would there be a reason for it to be null?

Copy link
Contributor

Choose a reason for hiding this comment

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

I might be missing something. :) I meant that this says "namespaceDeclarations" but the type of the Set isn't more specific. If this also encompasses module declarations I'd rename the field to represent both.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh my bad, VSCode made it look like you were writing the question mark as a nullable symbol rather than the entirety as a question.


for (final decl in topLevelDeclarations) {
if (decl case final VariableDeclaration variable) {
if (variable.modifier == VariableModifier.$const) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd avoid the code duplication and let emit handle this check and then just type-check the result before adding it to the lists, even if it means an extra type-check.

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.

Interop Gen: Add support for TS Reference Compiler Directives Interop Gen: Support Modules
2 participants