@glint Directives
Glint has several directives that can be used in template comments to control Glint's behavior. Additional comment text can follow directives to document their purpose. These directives correspond to the similarly-named directives in TypeScript.
@glint
directives may only be applied in template comments, not in TypeScript outside of templates.
@glint-expect-error
@glint-expect-error
The @glint-expect-error
directive operates similarly to @glint-ignore
in that it will not report type errors it encounters, but it will also produce an error when an error is not encountered. This is useful for tests where we expect an invocation not to type-check (e.g. due to bad arguments) and want to be alerted if it does.
Example:
@glint-ignore
@glint-ignore
The @glint-ignore
directive tells Glint to ignore the line that follows it. Glint will not report any errors encountered on the next line. In general, you should prefer @glint-expect-error
unless it is not appropriate.
Example:
@glint-nocheck
@glint-nocheck
The @glint-nocheck
directive will cause glint to not report errors for the entire template. The template is still processed by Glint such that auto-complete, type look-up, jump to definition, etc. are still functional, but any type errors will be ignored. This can be useful as a step in a migration process.
Example:
Note: the auto-glint-nocheck
script in the @glint/scripts
package can automate the process of adding @glint-nocheck
directives at the top of every template with type errors in your project. This allows you to adopt Glint in a project immediately for all new templates while incrementally migrating your existing ones to make them typesafe over time.
Last updated