Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Yes—a library can type-check templates without compiling them as part of a build. In an October 6, 2026 article, Jonas Gauffin describes a separate @relax.js/core check command that uses TypeScript’s compiler API to inspect supported template literals and report type errors before rendering. Its coverage depends on how the template is written and whether the checker can resolve its types.

Why check templates that TypeScript sees as strings?

When a template is embedded in a string or tagged template literal, ordinary TypeScript checking may not validate the expressions inside it. A misspelled view-model property or an invalid event attribute can therefore escape checks that would catch comparable mistakes in TypeScript code.

Gauffin’s described checker reads the project’s tsconfig.json, finds literal compileTemplate calls and html tagged template literals, then resolves supported expressions against TypeScript types. It emits diagnostics in a tsc-like format, with locations pointing to the relevant expression. The described implementation adds a check command rather than a build step; it is not an editor service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the checker validates

Template expressions and loops

  • Interpolation paths, if and unless expressions, and handler arguments are checked segment by segment against the relevant type.
  • Null and undefined values are traversed because the runtime renders them as empty. Array access such as [0] resolves to the array’s element type; traversal stops at any.
  • A loop such as loop="row in rows" requires rows to be an array and checks row as the element type within the loop.

Function calls, events, and pipes

  • Calls in interpolations and click handlers are checked against the functions context’s call signature and argument types. The handler’s event is typed as Event.
  • For an r-<event> attribute, the checker looks for the corresponding on<event> member on the element’s DOM type, using the same test as the runtime.
  • Pipes must be built in unless a registry is passed to the call. An interpolation opened with {{ must close on the same line.

Type information for each template form

For compileTemplate, the described API accepts type parameters for the view model passed to rendering and for the functions context. Without type arguments, the checker still performs syntax, event, and pipe checks, but it cannot resolve template paths against those types.

For html templates, the checker can infer a context type from a bind call in the same file. A bind function returned from, or called in, another file may not have an inferable context type. Gauffin’s examples show the checker catching a misspelled property, an unknown event attribute, and a dotted path where the html tag expects a flat property name.

Which templates are skipped or only partly checked?

The checker needs literal template text at the call site to inspect the expressions described above. Gauffin says it skips templates held in variables, built with ${} substitutions, or loaded from files. A template using compileTemplate without type arguments can still receive the non-path checks described earlier, but not path resolution.

The checker reports skipped templates and their reasons. A run with skipped templates is not equivalent to a fully checked run: review that summary rather than treating an absence of diagnostics as proof that every template was validated. If dynamic templates are intentional, a project can allow skips; if all templates are expected to be static, asserting that the skipped list is empty makes the limitation visible in routine validation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How closely does checking match rendering?

The runtime and checker share the expression grammar and event test, but handle HTML structure differently. The runtime uses DOMParser; the checker uses a small scanner under Node without a DOM. The scanner does not enforce browser content-model rules. As a result, malformed markup—for example, a paragraph implicitly closed by a block element or a table row placed outside a table—can make loop-alias scope differ from rendered behavior. Keep templates well formed, especially where loop scope depends on surrounding markup.

How to make the check part of a project’s tests

  1. Run @relax.js/core check against the project configuration. The command reads tsconfig.json and reports diagnostics for supported templates.
  2. In the test suite, call checkProject(tsconfig) and assert that both the formatted diagnostics and skipped-template list are empty if the project expects every template to be statically checkable.
  3. If dynamic or file-loaded templates are legitimate, decide explicitly how to handle skips rather than silently treating them as checked. The strict no-skips assertion can be omitted where those cases are expected.

Gauffin describes TypeScript as an optional peer dependency loaded for the check command rather than the runtime. That is a claim about the implementation in his October 6, 2026 article, not independent confirmation of the package’s current release behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How this differs from integrated template checking

Aspect Framework-integrated checking Relax.js approach described by Gauffin
How checking runs Part of the framework’s compiler Separate @relax.js/core check command
Editor feedback Angular is described as offering editor integration No editor squiggles are provided
Template coverage Not specified for Angular in the cited article Typed literal templates are checked; file-loaded and dynamic templates are not inspected
HTML parsing Not specified for Angular in the cited article Uses a Node-side scanner that does not apply browser content-model rules

The practical distinction is not simply whether templates can be checked. It is whether checks run as part of an integrated compiler and editor workflow, or as a separate validation step with explicit limits on which template forms it can analyze.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.