From bd605a4f288a5d5bcba5ad8a3b47421510867255 Mon Sep 17 00:00:00 2001 From: Tom Elliott Date: Fri, 7 Feb 2025 13:31:30 +1300 Subject: [PATCH] bump R version dependency --- DESCRIPTION | 2 ++ R/types.R | 7 +++++++ man/ts_logical.Rd | 8 ++++++++ tests/testthat/test-functions.R | 3 --- vignettes/simple-react-app.Rmd | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 50cabba..f67a466 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,6 +11,8 @@ Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 Config/testthat/edition: 3 +Depends: + R (>= 4.1.0) Imports: rlang, Rserve diff --git a/R/types.R b/R/types.R index 073feba..4605d54 100644 --- a/R/types.R +++ b/R/types.R @@ -152,6 +152,13 @@ n_type_fun <- function(n, type) { #' @return A ts object that accepts logical scalars or vectors of length `n`. #' @export #' @md +#' @examples +#' x <- ts_logical(1) +#' x$check(TRUE) +#' +#' \dontrun{ +#' x$check(5) +#' } ts_logical <- function(n = -1L) { ts_object( n_type(n, "z.boolean()"), diff --git a/man/ts_logical.Rd b/man/ts_logical.Rd index 30e608a..29070c6 100644 --- a/man/ts_logical.Rd +++ b/man/ts_logical.Rd @@ -16,3 +16,11 @@ A ts object that accepts logical scalars or vectors of length \code{n}. Booleans are represented in Zod schema as either a boolean (\code{z.boolean()}), or a typed Uint8Array (\code{z.instanceof(Uint8Array)}). } +\examples{ +x <- ts_logical(1) +x$check(TRUE) + +\dontrun{ +x$check(5) +} +} diff --git a/tests/testthat/test-functions.R b/tests/testthat/test-functions.R index 0bde1cd..74aeefe 100644 --- a/tests/testthat/test-functions.R +++ b/tests/testthat/test-functions.R @@ -1,6 +1,3 @@ -# # optional, check arguments - useful for debugging/development -# check_args(match.call(), formals()) - test_that("anonomous function definitions", { add <- ts_function( function(a = ts_numeric(1), b = ts_numeric(1)) a + b, diff --git a/vignettes/simple-react-app.Rmd b/vignettes/simple-react-app.Rmd index ffe3765..55badb5 100644 --- a/vignettes/simple-react-app.Rmd +++ b/vignettes/simple-react-app.Rmd @@ -38,7 +38,7 @@ That's it! We'll use `ts_compile()` later to create the server code and Typescri ## Create the React app -I'm using [Vite](https://vitejs.dev/) to create the app, but you could use any framework. Whatever you use, you'll need to be able to bundle the code (including libraries such as [zod](https://zod.dev)). +I'm using [Vite](https://vite.dev/) to create the app, but you could use any framework. Whatever you use, you'll need to be able to bundle the code (including libraries such as [zod](https://zod.dev)). ```bash pnpm create vite faithful-demo --template vanilla-ts