Skip to content

Commit d4291a2

Browse files
committed
Add more comments.
1 parent 691caab commit d4291a2

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

packages/lit-html/src/lit-html.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,15 @@ export type UncompiledTemplateResult<T extends ResultType = ResultType> = {
473473
values: unknown[];
474474
};
475475

476+
/**
477+
* This is a template result that may be either uncompiled or compiled.
478+
*
479+
* In the future, TemplateResult will be this type. If you want to explicitly
480+
* note that a template result is potentially compiled, you can reference this
481+
* type and it will continue to behave the same through the next major version
482+
* of Lit. This can be useful for code that wants to prepare for the next
483+
* major version of Lit.
484+
*/
476485
export type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =
477486
| UncompiledTemplateResult<T>
478487
| CompiledTemplateResult;
@@ -492,8 +501,8 @@ export type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =
492501
* In Lit 4, this type will be an alias of
493502
* MaybeCompiledTemplateResult, so that code will get type errors if it assumes
494503
* that Lit templates are not compiled. When deliberately working with only
495-
* one, use either CompiledTemplateResult or UncompiledTemplateResult
496-
* explicitly.
504+
* one, use either {@linkcode CompiledTemplateResult} or
505+
* {@linkcode UncompiledTemplateResult} explicitly.
497506
*/
498507
export type TemplateResult<T extends ResultType = ResultType> =
499508
UncompiledTemplateResult<T>;
@@ -502,6 +511,10 @@ export type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;
502511

503512
export type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;
504513

514+
/**
515+
* A TemplateResult that has been compiled by @lit-labs/compiler, skipping the
516+
* prepare step.
517+
*/
505518
export interface CompiledTemplateResult {
506519
// This is a factory in order to make template initialization lazy
507520
// and allow ShadyRenderOptions scope to be passed in.

0 commit comments

Comments
 (0)