Alright, closing the loop, I was finally able to generate an discount JS/TS function extension with pnpm.
The final piece was adding this to project’s .npmrc:
strict-peer-dependencies=false
auto-install-peers=true
shamefully-hoist=true
It’s the same as the Shopify CLI monorepo.