Closed carlitux closed 4 years ago
I don't use TypeScript, maybe someone who contributed the ts definitions can chime in - @awwong1 / @tomc974 (was it this change -- https://github.com/dougmoscrop/serverless-http/commit/d15fc767690b9cb853549854baf2001d5fd6462a#diff-2dfb4ffe9905581b8cba9e8ef3fed4fb ?)
Hi!
The change I made was to fix the export of the module to be a function. The TypeScript definitions was not in agreement with the actual code on this matter.
The proper way to import such a module (which is not ECMAScript compatible) is to use a different kind of import statement
import serverless = require('serverless-http')
Alternatively, you can enable the esModuleInterop
compiler setting if you still want to use ECMAScript import with incompatible modules.
Let me know if this solve your issue.
I'm having the same issue even after enabling the "esModuleInterop" flag in tsconfig
@grath90 Could you try with the non-ECMAScript import syntax and tell me if the problem remains?
@tomc974 I imported with a standard node require and the error went away. Which is fine for me, but I am curious why enabling the flag didn't fix it.
Flagged as help wanted since I don't use TS - if someone can help me understand if this needs changes or is fixed that would be great.
FWIW this has regressed again, if #126 fixed this issue at a point in time.