Remix App Embed - javascript code bundling

What is the proper way to develop custom js code for app-embed?

Im looking for typescript and when i do shopify app build, bundle/minimify it in to app.js. But the question is how to store them?

Since extension can only contain .js files, and how to make it work properly with shopify app build/dev , so it will be bundled on build, and watched/synced on dev stage

Write your code in TypeScript, then transpile it to plain .js with a bundler (Vite, Webpack, or esbuild). Only the compiled .js goes in the extension folder, since Shopify doesn’t allow .ts files. Make sure your build script outputs to /extensions/.../assets so shopify app dev can watch and sync changes.