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

Refactor to improve types for hue-* rules #5494

Merged
merged 1 commit into from Aug 24, 2021
Merged

Conversation

ybiquitous
Copy link
Member

Which issue, if any, is this issue related to?

Part of #4496

Is there anything in the PR that needs further explanation?

This change removes // @ts-nocheck from the hue-* rules.

This change removes `// @ts-nocheck` from the `hue-*` rules.
function asNumber(value) {
const { number } = valueParser.unit(value);
const dimension = valueParser.unit(value);
Copy link
Member Author

Choose a reason for hiding this comment

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

[note] valueParser.unit() returns valueParser.Dimension or false. See below:

https://github.com/TrySound/postcss-value-parser/blob/v4.1.0/lib/index.d.ts#L134

@@ -102,19 +112,25 @@ function findHue(node) {
return args[2];
}

return false;
return undefined;
Copy link
Member Author

Choose a reason for hiding this comment

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

[note] The findHue() function now returns valueParser.Node or undefined. I think it's a more common pattern to return undefined instead of false.

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@jeddy3 jeddy3 merged commit 4969f65 into v14 Aug 24, 2021
@jeddy3 jeddy3 deleted the refactor-types-for-hue-rules branch August 24, 2021 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants