Skip to content

Commit 5daeaed

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

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,13 @@ type ImmutableArray<T> = {
4545
function narrowLiterals<T extends string>(array: Array<T>): Array<T>;
4646
function narrowLiterals<T extends number>(array: Array<T>): Array<T>;
4747
function narrowLiterals(array) {return array;}
48+
49+
/**
50+
* Declared return type is the same as the passed function `fn`.
51+
* However, at runtime, always returns undefined and never invokes `fn`.
52+
* Useful for getting the type of an expression without any runtime side-effects.
53+
* TypeScript otherwise doesn't have any syntax for getting the inferred type of an expression.
54+
*/
55+
function typeOfExpression<T>(fn: (_?: any) => T): T;
56+
function typeOfExpression() {};
4857
```

0 commit comments

Comments
 (0)