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

Add a guide for TypeScript #599

Merged
merged 6 commits into from
Jan 7, 2022
Merged

Add a guide for TypeScript #599

merged 6 commits into from
Jan 7, 2022

Conversation

cowboyd
Copy link
Member

@cowboyd cowboyd commented Jan 6, 2022

Motivation

There are some pitfalls with using Effection and TypeScript together, and with the expectations of type-safety that come with TypeScript, it can be one of the biggest stumbling blocks to adoption. While we can't fix them directly (only the TypeScript team can do that), we can at least explain what they are, why they can't be fixed by anybody but the TypeScript team, and ways that you can mitigate them.

Approach

I tried to just enumerate the challenges that we've encountered, and propose some of the solutions.

Things I'm not entirely sure of:

  • Is this the best location for this guide?
  • In which order should I put the sections: The one on operations first? or generators?

There are some pitfalls with using Effection and TypeScript
together. While we can't fix them, we can at least explain what they
are and ways that you can mitigate them.
@taras
Copy link
Member

taras commented Jan 6, 2022

Effection itself is written in TypeScript, and so comes bundled with its own type definitions. As a result, there's nothing special required to make them interoperate. However, there are still some idiosyncracies with using Effection and TypeScript together. This section contains information about what these idiosyncrasies are, and what you can do to make your development experience as painless as possible.

@cowboyd what do you think about this instead

Effection is written in TypeScript and comes bundled with its own type definitions. Effection doesn't require any special setup to use in a TypeScript project, but there are some TypeScript specific idiosyncrasies to keep in mind. This section describes these idiosyncrasies and what you can do to make development experience of using Effection in your TypeScript project as painless as possible.

@cowboyd
Copy link
Member Author

cowboyd commented Jan 6, 2022

@taras Feels great!

Copy link
Contributor

@dagda1 dagda1 left a comment

Choose a reason for hiding this comment

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

I definitely like the unwrap helper 👍

@cowboyd
Copy link
Member Author

cowboyd commented Jan 7, 2022

@taras @dagda1 What would you think about adding a suggestion that they respectfully upvote the issue for generator typing on GitHub? The TS folks have indicated that it's the best way to register interest.

@dagda1
Copy link
Contributor

dagda1 commented Jan 7, 2022

@taras @dagda1 What would you think about adding a suggestion that they respectfully upvote the issue for generator typing on GitHub? The TS folks have indicated that it's the best way to register interest.

I don't think it would do any harm. If generators were more mainstream then they would do something.

@cowboyd
Copy link
Member Author

cowboyd commented Jan 7, 2022

I'm going to go ahead and merge. @taras LMK if you have any feedback on the CTA at the end and I'll submit another PR.

@cowboyd cowboyd merged commit cae734c into v2 Jan 7, 2022
@cowboyd cowboyd deleted the typescript-guide branch January 7, 2022 11:12
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.

3 participants