assemblyscript icon indicating copy to clipboard operation
assemblyscript copied to clipboard

Guidelines for integration with existing TypeScript project

Open Vasile-Peste opened this issue 3 years ago • 1 comments

Hello, first of all the project looks very cool and promising.

Second, it's not currently very clear on how to integrate it with existing TypeScript projects. Do you have any special guide for this? I have some doubts for a situation where the codebase of a project is already written in TypeScript and someone wants to add some AssemblyScript to it:

  1. Should we keep using .ts extension for AssemblyScript files in the project? This will generate issues with the original TS compiler, right?
  2. The current TypeScript out directory is called "build", what could happen if we use the same for AS?
  3. What would be the build workflow? First we build AS and then TypeScript? How we should handle the imports of AS modules from TS files?

Probably I missed some things given that I'm new to WebAssembly, thank you for you time!

Vasile-Peste avatar Sep 08 '22 01:09 Vasile-Peste

Regarding (1), what's typically done is that the TS and the AS sources live in their own directories (say src for TS and assembly for AS), each with their own tsconfig.json. The TS language server picks the separate configs up. Regarding (2), that depends on how the files are named I think, but seems unlikely to conflict in general. Regarding (3), the AS compiler can generate JS bindings with TS type definitions. These would then be imported from TS out of the build directory, so in order for TS to use the latest AS build, the Wasm build would have to run first. Does that help? :)

dcodeIO avatar Sep 08 '22 08:09 dcodeIO

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Oct 08 '22 23:10 github-actions[bot]