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

feat: add require-compound-type-alias option to create an exception for x | null types #390

gajus opened this issue Feb 18, 2019 · 3 comments


Copy link

gajus commented Feb 18, 2019

Most of the require-compound-type-alias errors that I get refer to explicit or NULL types, e.g.

type PoolContextType = {|
  +log: LoggerType,
  +poolId: string,
  +query: TaggedTemplateLiteralInvocationType | null

In this case creating a separate type would have little added value.

Copy link
Owner Author

gajus commented Feb 18, 2019

CC @pnevyk In case this is relevant to you too.

Copy link

pnevyk commented Feb 18, 2019

It looks like an easy fix to me, something that can be a good first PR. If anyone is interested, the task is to enhance both visitor rules in this file to check if node.types.length == 2 and one of the nodes in node.types is of type "NullLiteralTypeAnnotation" if this option is enabled, and to update the rule schema.

@gajus If nobody takes this up, I will do it in (hopefully) near future in a free while.

Copy link
Owner Author

gajus commented May 18, 2020

🎉 This issue has been resolved in version 5.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants