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

Update export types #2170

Merged
merged 6 commits into from
Nov 2, 2023
Merged

Update export types #2170

merged 6 commits into from
Nov 2, 2023

Conversation

dbritto-dev
Copy link
Collaborator

@dbritto-dev dbritto-dev commented Nov 1, 2023

Related Issues or Discussions

Fixes #2163

Summary

The types for should be under each type of import. For instance "import", "module", "require" and "default"

Check List

  • yarn run prettier for formatting code and docs

Copy link

vercel bot commented Nov 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zustand-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 2, 2023 0:51am

@dbritto-dev dbritto-dev changed the title Use export types Update export types Nov 1, 2023
Copy link

codesandbox-ci bot commented Nov 1, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit bf044d7:

Sandbox Source
React Configuration
React TypeScript Configuration
React Browserify Configuration
React Snowpack Configuration
React Parcel Configuration
Next.js Configuration
@pavlobu/zustand demo Configuration

@dbritto-dev
Copy link
Collaborator Author

@dai-shi here you go

@dai-shi
Copy link
Member

dai-shi commented Nov 1, 2023

Related Issues or Discussions

Fixes #2164

Do you mean #2163 ?

package.json Outdated Show resolved Hide resolved
@dbritto-dev
Copy link
Collaborator Author

Related Issues or Discussions

Fixes #2164

Do you mean #2163 ?

Yeah, that one

@dbritto-dev
Copy link
Collaborator Author

@dai-shi all yours

@dbritto-dev dbritto-dev self-assigned this Nov 1, 2023
@dbritto-dev dbritto-dev added the bug Something isn't working label Nov 1, 2023
package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@dai-shi
Copy link
Member

dai-shi commented Nov 2, 2023

btw, @dbritto-dev do you understand why #2157 caused such an issue? It seems like TS picks different files for index and middleware, but I'm not sure how that could happen. It sounds like TS ignore "types" field, doesn't it?

@dbritto-dev
Copy link
Collaborator Author

dbritto-dev commented Nov 2, 2023

btw, @dbritto-dev do you understand why #2157 caused such an issue? It seems like TS picks different files for index and middleware, but I'm not sure how that could happen. It sounds like TS ignore "types" field, doesn't it?

@dai-shi I understand the issue, in the case of inner packages when you use "types" outside of "import", "module", "require" or "default" ts use by default that types ignoring where you are importing the packages; when we added the new changes for the main package we fixed that but the inner packages still pointing to "d.ts" even if you are importing them from "esm" so that's the conflict

In a nutshell the types were always imported from *.d.ts instead of being imported from where you are importing them, like esm/*.d.ts or esm/*.d.mts. We fixed it for the main package but the inner packages needs the same change.

@dbritto-dev
Copy link
Collaborator Author

@dai-shi all yours

@dai-shi
Copy link
Member

dai-shi commented Nov 2, 2023

in the case of inner packages when you use "types" outside of "import", "module", "require" or "default" ts use by default that types ignoring where you are importing the packages;

So, the "types" line right under "exports" in v4.4.4 package.json was simply ignored? That explains it.

@dbritto-dev
Copy link
Collaborator Author

@dai-shi would you mind taking care of these changes? I tested locally and works well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants