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

Request: Export type-checking function(s) (e.g. standalone-check-types) #1672

Closed
orgadish opened this issue Nov 22, 2023 · 2 comments
Closed

Comments

@orgadish
Copy link

rlang has an excellent set of check_XXX functions with tailored error messages. It would be great if this were available (and maintained) for public use -- in my mind, this would supersede assertthat, which has not been updated in over 4 years (or vec_assert which is lifecycle: questioning).

Alternatively, these could be exported using a single function (e.g. rlang::check) which takes one of the already exported rlang::is_ functions and generates a good error message. e.g. rlang::check(x, rlang::is_string, allow_null = FALSE, allow_na = TRUE)

Related to discussion in #1111

@olivroy
Copy link
Contributor

olivroy commented Nov 23, 2023

I think there may be plans to create a new package for that:
tidyverse/design#160 (comment)

But meanwhile, in your packages, you can use
usethis::use_standalone("r-lib/rlang", "type-check")

See ggplot2 https://github.com/tidyverse/ggplot2/blob/main/R/import-standalone-types-check.R

https://usethis.r-lib.org/reference/use_standalone.html?q=use_sta#null

@orgadish
Copy link
Author

Thanks for the use_standalone tip!

I hope tidyverse/design#160 goes through!

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

No branches or pull requests

2 participants