-
Notifications
You must be signed in to change notification settings - Fork 18
Invalid type definitions - static import of ESM types from CJS types #447
Comments
Thanks for reporting this! It's good to know there's a workaround, i'll add it to our internal triage. |
I'm a bit surprised about TypeScript emitting this error for a |
They're not using |
We're only importing https://github.com/netlify/functions/blob/main/src/function/v2.ts#L1 So I don't think that an actual import line shows up in the generated JS file. This seems to be purely about the declaration file that TypeScript generates, and I would have expected TypeScript to generate it in a way that's compliant with CJS, because that's how it's configured: Line 27 in 7552375
Anyways, distributing this as ESM makes sense to me. @eduardoboucas do you see any reason why this might become a problem? Maybe consumption from within Next.js sites? |
I think this will be fixed by #473 |
I can verify that #473 fixes this. We're on version 3.0.0 and no longer receive this error so we've removed the |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Configuration
Import the library in a project which has the following in the
tsconfig.json
:This issue can be worked around with
"skipLibCheck": true
, so ensure that is not set when reproducing. It is not set by default.The text was updated successfully, but these errors were encountered: