Skip to content

Commit

Permalink
Add more comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
rictic committed Oct 31, 2023
1 parent 691caab commit d4291a2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/lit-html/src/lit-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,15 @@ export type UncompiledTemplateResult<T extends ResultType = ResultType> = {
values: unknown[];
};

/**
* This is a template result that may be either uncompiled or compiled.
*
* In the future, TemplateResult will be this type. If you want to explicitly
* note that a template result is potentially compiled, you can reference this
* type and it will continue to behave the same through the next major version
* of Lit. This can be useful for code that wants to prepare for the next
* major version of Lit.
*/
export type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =
| UncompiledTemplateResult<T>
| CompiledTemplateResult;
Expand All @@ -492,8 +501,8 @@ export type MaybeCompiledTemplateResult<T extends ResultType = ResultType> =
* In Lit 4, this type will be an alias of
* MaybeCompiledTemplateResult, so that code will get type errors if it assumes
* that Lit templates are not compiled. When deliberately working with only
* one, use either CompiledTemplateResult or UncompiledTemplateResult
* explicitly.
* one, use either {@linkcode CompiledTemplateResult} or
* {@linkcode UncompiledTemplateResult} explicitly.
*/
export type TemplateResult<T extends ResultType = ResultType> =
UncompiledTemplateResult<T>;
Expand All @@ -502,6 +511,10 @@ export type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>;

export type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>;

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

0 comments on commit d4291a2

Please sign in to comment.