Skip to content

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

Closed
CountBleck wants to merge 1 commit intoAssemblyScript:mainfrom
CountBleck:fix-transform-types
Closed

Fix .d.ts type for Transform#afterCompile#2830
CountBleck wants to merge 1 commit intoAssemblyScript:mainfrom
CountBleck:fix-transform-types

Conversation

@CountBleck
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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