Skip to content

Commit 1ecc8ec

Browse files
authored
Update README.md
1 parent 5daeaed commit 1ecc8ec

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ function narrowLiterals(array) {return array;}
5151
* However, at runtime, always returns undefined and never invokes `fn`.
5252
* Useful for getting the type of an expression without any runtime side-effects.
5353
* TypeScript otherwise doesn't have any syntax for getting the inferred type of an expression.
54+
*
55+
* Usage:
56+
* const __ignored = typeOfExpression(() => classFactoryFoo('bar'));
57+
* type MyType = typeof __ignored;
5458
*/
5559
function typeOfExpression<T>(fn: (_?: any) => T): T;
5660
function typeOfExpression() {};

0 commit comments

Comments
 (0)