Dynamic import results in esm #2555
Labels
api: storage
Issues related to the googleapis/nodejs-storage API.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Please make sure you have searched for information in the following guides.
A screenshot that you have tested with "Try this API".
N/A - types issue
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
https://gist.github.com/prescottprue/b77e59c85941d2e93766e9055819da99
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
import type { Storage, File } from '@google-cloud/storage
(typescript by default uses cjs types unless you are doing full ESMA clear and concise description of what the bug is, and what you expected to happen.
CJS types are pulled in when
import type
if repo is not ESM, but using dynamic import causes ESM types to be pulled in. Since the types are not the same there is an error saying:I've also tried the resolution-mode on both the import and the type import but that didn't work (regardless of import/reuqire setting):
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
It is expected that the types match between cjs and esm as they do with
@google-cloud/pubsub
: https://github.com/googleapis/nodejs-pubsub/blob/main/package.json. With PubSub lib dynamic import is no issueThe text was updated successfully, but these errors were encountered: