Skip to content

Commit

Permalink
feat(let): improve type checking for tuiLet (#98)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Sedov <darragon-nn@yandex.ru>
  • Loading branch information
fynnfeldpausch and MarsiBarsi authored Jan 14, 2021
1 parent ea1b4cd commit 5cff8ae
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions projects/cdk/directives/let/let.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ export class TuiLetDirective<T> {
) {
viewContainer.createEmbeddedView(templateRef, new TuiLetContext<T>(this));
}

/**
* Asserts the correct type of the context for the template that `TuiLet` will render.
*
* The presence of this method is a signal to the Ivy template type-check compiler that the
* `TuiLet` structural directive renders its template with a specific context type.
*/
static ngTemplateContextGuard<T>(
_dir: TuiLetDirective<T>,
_ctx: any,
): _ctx is TuiLetDirective<T> {
return true;
}
}

0 comments on commit 5cff8ae

Please sign in to comment.