We currently rely on the TS behavior of matching `d.ts` files based on
the `.js` file names. e.g. `foo.js` matches `foo.d.ts`. However, it
isn't working for all tools so we should explicitly set it.
Most modern packages are still setting it even though it is not
technically needed. e.g.
[Nuxt](https://unpkg.com/browse/nuxt@3.12.4/package.json)
Note: If both ESM and CJS are present, then prefer `*.esm.d.ts` files
since the generated types are in ESM format.
## Current Behavior
`exports` entries are missing `types` field
## Expected Behavior
`exports` entries have `types` field set
## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
Fixes#18835