Skip to content

Fix .d.ts type for Transform#afterCompile #2830

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

Closed

Conversation

CountBleck
Copy link
Member

Changes proposed in this pull request:
⯈ Fix the .d.ts type for Transform#afterCompile

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@CountBleck CountBleck requested a review from dcodeIO March 24, 2024 15:56
@mattjohnsonpint
Copy link
Contributor

mattjohnsonpint commented Mar 25, 2024

This creates an error in the generated /dist/asc.generated.d.ts:

declare module "types:assemblyscript/lib/binaryen" {
    export * from "types:assemblyscript/binaryen";
    export { default } from "types:assemblyscript/binaryen";
}

types:assemblyscript/binaryen doesn't exist.

I found a solution by modifying:

resolveModuleImport: ({ importedModuleId, currentModuleId }) => {
return currentModuleId == "cli/index" && importedModuleId == "../src"
? prefix + "/src/index"
: null;
},

to be:

    resolveModuleImport: ({ importedModuleId, currentModuleId }) => {
      if (currentModuleId == "cli/index" && importedModuleId == "../src")
        return prefix + "/src/index";

      if (importedModuleId == "binaryen")
        return "binaryen";

      return null;
    },

@mattjohnsonpint mattjohnsonpint mentioned this pull request Mar 25, 2024
2 tasks
@CountBleck
Copy link
Member Author

Closing in favor of #2832

@CountBleck CountBleck closed this Mar 25, 2024
@CountBleck CountBleck deleted the fix-transform-types branch January 1, 2025 02:03
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