Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Latest Version of TypeScript (5.2.2) #1103

Closed
schmalzs opened this issue Sep 14, 2023 · 2 comments
Closed

Issues with Latest Version of TypeScript (5.2.2) #1103

schmalzs opened this issue Sep 14, 2023 · 2 comments
Labels

Comments

@schmalzs
Copy link

Describe the bug

The latest version of TypeScript (5.2.2) has problems correctly identifying the CommonJS version of Middy that is available in the package.

I've outlined the details of what I am seeing in this demo repo

To Reproduce

See the Demo Problem Using This Repo section of the README of my repo linked above.

Expected behaviour

TypeScript is able to properly identify the CommonJS version of the Middy package that is available.

Environment (please complete the following information):

  • Node.js: 18
  • Middy: 4.6.2
  • AWS SDK: N/A

Additional context

See details in the README of [this demo repo](I've outlined the details of what I am seeing in this repo.

The potential fix I outline in the README seems pretty simple -- my suggestion is to introduce an index.d.cts type definitions file (note the .cts extension) which seems to give TypeScript the kick in the butt it needs to properly identify the CommonJS version of the package.

Ancillary to this...others are having issues with building "hybrid" packages with TypeScript 5.2.2. Middy doesn't seem impacted by that though since it's not actually written in TypeScript; instead, it is just helpful by including type definitions 🙂

@schmalzs schmalzs added the bug label Sep 14, 2023
@schmalzs
Copy link
Author

Also worth noting that I am happy to PR -- would just want some guidance on how Middy's build process works and how to introduce an index.d.cts file into it.

@willfarrell
Copy link
Member

Thanks for reporting with an example. Since we're planning to drop cjs support in the next version of Middy soon (just waiting on the next lambda runtime to be released ... maybe Nov). We're having enough trouble maintaining one set of types, let alone two. So, I'm going to have to say we're not going to make changes to support this. Sorry.

Two options:
a) lock the version of TypeScript to an older one that works with Middy
b) Report issue to the TypeScript team to resolve on their end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants