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

Fix multiple TS build and packaging issues #3672

Merged
merged 4 commits into from Aug 26, 2023

Conversation

markerikson
Copy link
Collaborator

@markerikson markerikson commented Aug 24, 2023

This PR:

  • Updates tsup to 7.2.0, to pick up the "multiple declarations" feature from Ensure matching declaration file exists for each output bundle format egoist/tsup#934
  • Tries to fix all of our uses of /dist/ in type imports, by re-exporting needed types
  • Updates our tsup config to generate typedefs for ESM and CJS formats, and switches to using those typedef files instead of building individual files with tsc
  • Updates all package exports to list separate JS + DTS files for ESM and CJS for each entry point
  • Switches to use the official are-the-types-wrong CLI package for checking output, instead of the homegrown CLI I'd thrown together

Somewhat surprisingly, this actually appears to fix all outstanding ATTW issues locally:

image**

Update

Yeah, I gave up on pre-bundling our TS typedefs for RTK. I'm also going to punt completely on fixing the "FalseCJS" warning from attw.

We have some really complicated uses of interface merging in RTK Query, and bundling the typedefs was completely breaking that, as we no longer had paths like "@reduxjs/toolkit/dist/query/apiTypes" on disk. Plus, uses of declare module "../../endpointDefinitions" seemed busted too.

I tried copy-pasting all the individual .d.ts files to .d.mts/cts, but that seemed to result in a lot of internal resolution errors from attw.

I did generally replace all of the remaining uses of /dist/, and exported a few more types publicly.

@codesandbox
Copy link

codesandbox bot commented Aug 24, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 24, 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 25b84d0:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration
rsk-github-issues-example Configuration
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration
rtk-esm-cra Configuration

@netlify
Copy link

netlify bot commented Aug 24, 2023

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit dbd5d21
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/64e6b45bbc664a00086e9431
😎 Deploy Preview https://deploy-preview-3672--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Aug 24, 2023

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit 25b84d0
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/64ea563025137800080a8326
😎 Deploy Preview https://deploy-preview-3672--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@markerikson markerikson force-pushed the feature/3516-fix-dist-types branch 3 times, most recently from 33864fc to 7a292cb Compare August 26, 2023 00:28
@markerikson markerikson merged commit 1ee08e0 into v2.0-integration Aug 26, 2023
38 checks passed
@markerikson markerikson deleted the feature/3516-fix-dist-types branch August 26, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant