summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/node/node_modules/lit-html/directives/when.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/node/node_modules/lit-html/directives/when.d.ts')
-rw-r--r--chromium/third_party/node/node_modules/lit-html/directives/when.d.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/chromium/third_party/node/node_modules/lit-html/directives/when.d.ts b/chromium/third_party/node/node_modules/lit-html/directives/when.d.ts
new file mode 100644
index 00000000000..1af1e70004c
--- /dev/null
+++ b/chromium/third_party/node/node_modules/lit-html/directives/when.d.ts
@@ -0,0 +1,28 @@
+/**
+ * @license
+ * Copyright 2021 Google LLC
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+type Falsy = null | undefined | false | 0 | -0 | 0n | '';
+/**
+ * When `condition` is true, returns the result of calling `trueCase()`, else
+ * returns the result of calling `falseCase()` if `falseCase` is defined.
+ *
+ * This is a convenience wrapper around a ternary expression that makes it a
+ * little nicer to write an inline conditional without an else.
+ *
+ * @example
+ *
+ * ```ts
+ * render() {
+ * return html`
+ * ${when(this.user, () => html`User: ${this.user.username}`, () => html`Sign In...`)}
+ * `;
+ * }
+ * ```
+ */
+export declare function when<C extends Falsy, T, F = undefined>(condition: C, trueCase: (c: C) => T, falseCase?: (c: C) => F): F;
+export declare function when<C, T, F>(condition: C extends Falsy ? never : C, trueCase: (c: C) => T, falseCase?: (c: C) => F): T;
+export declare function when<C, T, F = undefined>(condition: C, trueCase: (c: Exclude<C, Falsy>) => T, falseCase?: (c: Extract<C, Falsy>) => F): C extends Falsy ? F : T;
+export {};
+//# sourceMappingURL=when.d.ts.map \ No newline at end of file