Skip to content

Commit

Permalink
Update examples/raw-templates/raw_templates.md
Browse files Browse the repository at this point in the history
Co-authored-by: Maryam Ziyad <maryamziyadm@gmail.com>
  • Loading branch information
heshanpadmasiri and MaryamZi authored Oct 28, 2024
1 parent 71a8d44 commit a099fce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/raw-templates/raw_templates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Raw templates

Raw template expressions are backtick templates without a tag (such as `string` or `xml`). This is a sequence of characters interleaved with interpolations within a pair of backticks (in the form`${expression}`). The result of evaluating such a raw template is a `RawTemplate` object that has two fields `(readonly & string[]) strings` and `(any|error)[] insertions`. The `strings` array will have string literals in the backtick string broken at interpolations and the `insertions` array will have the resultant values of evaluating each interpolation.
Raw template expressions are backtick templates without a tag (such as `string` or `xml`). This is a sequence of characters interleaved with interpolations within a pair of backticks (in the form `${expression}`). The result of evaluating such a raw template is a `RawTemplate` object that has two fields `(readonly & string[]) strings` and `(any|error)[] insertions`. The `strings` array will have string literals in the backtick string broken at interpolations and the `insertions` array will have the resultant values of evaluating each interpolation.

If you want to control the type of values used for interpolation more precisely, you can define an object type that includes the `RawTemplate` type and give a narrower type for the `insertions` fields. Then, the compiler will statically verify that the corresponding values used for interpolation belong to the desired type.

Expand Down

0 comments on commit a099fce

Please sign in to comment.