Escape Hatches
Real-world R code uses patterns that cannot be statically typed — metaprogramming, eval(parse(...)), dynamic do.call — Infr provides explicit escape hatches rather than pretending these don't exist.
The any type
Opt out of type checking for a specific binding:
const result: any <- eval(parse(text = some_string))
# No type checking on `result`
@infr-ignore
Suppress the Infr diagnostic on the next line. Equivalent to TypeScript's @ts-ignore:
# @infr-ignore
x <- some_weird_metaprogramming_thing()
Use this sparingly. Each @infr-ignore is a spot where Infr can't help you catch bugs.
@infr-nocheck
Disable Infr checking for the entire file. Place at the top of the file:
# @infr-nocheck
# This file contains heavy NSE / metaprogramming. Skip checking for now.
Useful for:
- Work-in-progress files
- Files with heavy non-standard evaluation
- Generated code
- Files you want to skip during batch builds
When to use escape hatches
| Situation | Recommended approach |
|---|---|
| A function you know is correct but Infr can't type | @infr-ignore on the call |
| A whole file with heavy metaprogramming | @infr-nocheck at the top |
A value from eval, do.call, or similar | Annotate as any |
| A temporary workaround during migration | @infr-ignore with a TODO comment |
The goal is to keep escape hatches visible and minimal. Each one is a spot where you've opted out of safety — make them intentional.