webR 0.5.7 shipped on November 13, 2025. The release adds JSDoc documentation for typed evalR methods, improving IDE support and developer experience.
JSDoc Documentation for evalR Methods
Four type-specific evaluation methods now have inline JSDoc documentation:
evalRVoid
/**
* Evaluate the given R code, returning a promise for no return data.
* @param {string} code The R code to evaluate.
* @param {EvalROptions} [options] Options for the execution environment.
* @returns {Promise<void>} A promise which fires when the R code completes.
*/
await webR.evalRVoid('x <- 1:10');evalRBoolean
/**
* Evaluate the given R code, returning a promise for a boolean value.
* @param {string} code The R code to evaluate.
* @param {EvalROptions} [options] Options for the execution environment.
* @returns {Promise<boolean>} The result of the computation.
*/
const isPositive = await webR.evalRBoolean('5 > 0');evalRNumber
/**
* Evaluate the given R code, returning a promise for a number.
* @param {string} code The R code to evaluate.
* @param {EvalROptions} [options] Options for the execution environment.
* @returns {Promise<number>} The result of the computation.
*/
const mean = await webR.evalRNumber('mean(c(1, 2, 3, 4, 5))');evalRString
/**
* Evaluate the given R code, returning a promise for a string.
* @param {string} code The R code to evaluate.
* @param {EvalROptions} [options] Options for the execution environment.
* @returns {Promise<string>} The result of the computation.
*/
const version = await webR.evalRString('R.version.string');Developer Experience
These methods existed before 0.5.7 but lacked documentation. IDEs now show:
- Parameter types and descriptions
- Return type information
- Method purpose on hover
- IntelliSense autocomplete details
This matters when working with webR in TypeScript or JavaScript projects. Instead of checking GitHub or guessing parameter types, the documentation appears inline as you type.
When to Use Each Method
Choose the right evalR variant based on your expected return type:
- evalRVoid: Side effects only (assignments, plotting, package loading)
- evalRBoolean: Logical tests, comparisons
- evalRNumber: Numeric computations, statistics
- evalRString: Text output, version info, string operations
For complex objects, use the general evalR() method or captureR() for comprehensive output handling.
Live Example
Demonstrating Type-Specific evalR Methods
# evalRVoid - side effects only
x <- seq(1, 20, by=2)
cat('Created vector x\\n')
# evalRBoolean - logical test
all_positive <- all(x > 0)
cat('All values positive:', all_positive, '\\n')
# evalRNumber - numeric computation
mean_value <- mean(x)
cat('Mean:', mean_value, '\\n')
# evalRString - text output
summary_text <- paste('Vector of', length(x), 'values')
cat('Summary:', summary_text, '\\n')
This shortcode uses captureR() internally - another webR pattern that handles complex R objects safely.
Upgrade
Update via npm:
npm install [email protected]
Or via CDN:
<script type="module">
import { WebR } from 'https://webr.r-wasm.org/v0.5.7/webr.mjs';
</script>
The JSDoc improvements also shipped in earlier versions but were officially released in 0.5.7. Check the full changelog.