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

Use babel for typescript compilation with minimal changes #1738

Merged
merged 4 commits into from
Jun 25, 2021

Conversation

chuckdries
Copy link
Contributor

@chuckdries chuckdries commented Jun 23, 2021

Kicking off #1737 🚀

If the goal is to exactly match existing behavior, why fix what isn't broken? This change uses babel's typescript preset to compile typescript without any dramatic changes to the existing rollup-babel flow, and invokes tsc directly to check types only.

I included a little test.ts with a type error in it to demonstrate that module resolution and type checking both work. I tried turning on checkJs in the tsconfig but typescript does not like that one bit. We've got our work cut out for us :)

I do not know why there are so many deletions in the package.lock file

Edit: I just turned off my computer for the night but I realized I forgot to make it actually emit the type definitions. Sorry about the premature PR.

@netlify
Copy link

netlify bot commented Jun 23, 2021

✔️ Deploy Preview for react-redux-docs ready!

🔨 Explore the source changes: a9e65c9

🔍 Inspect the deploy log: https://app.netlify.com/sites/react-redux-docs/deploys/60d49d14217dd000082f920e

😎 Browse the preview: https://deploy-preview-1738--react-redux-docs.netlify.app

@markerikson
Copy link
Contributor

So just to confirm, the build failure is "intentional" for now, right? :)

@chuckdries chuckdries marked this pull request as draft June 24, 2021 02:12
@chuckdries
Copy link
Contributor Author

Yes, we should remove test.ts before we merge. I got it emitting types and typescript code in all 3 build modes, but eslint is still unhappy

@chuckdries chuckdries marked this pull request as ready for review June 24, 2021 14:56
"extends": [
"eslint:recommended",
"plugin:import/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended"
// "plugin:@typescript-eslint/recommended"
Copy link
Contributor Author

@chuckdries chuckdries Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Their documentation recommends turning this on, and we normally do in projects I work with, but it generates a lot of noise in the js files and I don't think there's a way to do an "extends" for only one type of file. I say we leave it off for now and consider turning it on when we're most of the way through the conversion, unless people on this project don't mind seeing and ignoring lint errors while they work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, my experience has been that ruleset is way to over-opinionated.

We don't want to be focusing on lint rules right now. The immediate goal is just to get stuff compiling at all, and then get most of the existing types into place. Linting would be a last step.

@markerikson
Copy link
Contributor

Seems like a reasonable starting point. Let's get this in!

@markerikson markerikson merged commit 66f1152 into reduxjs:typescript-port Jun 25, 2021
@chuckdries chuckdries deleted the typescript/compiler branch July 2, 2021 16:11
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.

2 participants