diff --git a/packages/lit-dev-content/site/docs/v3/templates/directives.md b/packages/lit-dev-content/site/docs/v3/templates/directives.md
index 0cff6100c..2e1e518d0 100644
--- a/packages/lit-dev-content/site/docs/v3/templates/directives.md
+++ b/packages/lit-dev-content/site/docs/v3/templates/directives.md
@@ -474,11 +474,11 @@ import {when} from 'lit/directives/when.js';
```ts
-when(
- condition: boolean,
- trueCase: () => T,
- falseCase?: () => F
-)
+when(
+ condition: C,
+ trueCase: (c: Exclude) => T,
+ falseCase?: (c: Extract) => F
+): C extends Falsy ? F : T
```
|
@@ -493,7 +493,7 @@ Any
-When `condition` is true, returns the result of calling `trueCase()`, else returns the result of calling `falseCase()` if `falseCase` is defined.
+When `condition` is truthy, returns the result of calling `trueCase()`, else returns the result of calling `falseCase()` if `falseCase` is defined. The (type-narrowed) `condition` value is passed to both case functions.
This is a convenience wrapper around a ternary expression that makes it a
little nicer to write an inline conditional without an else.
@@ -502,7 +502,7 @@ little nicer to write an inline conditional without an else.
class MyElement extends LitElement {
render() {
return html`
- ${when(this.user, () => html`User: ${this.user.username}`, () => html`Sign In...`)}
+ ${when(this.user, (user) => html`User: ${user.username}`, () => html`Sign In...`)}
`;
}
}