We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 085e402 commit 5daeaedCopy full SHA for 5daeaed
README.md
@@ -45,4 +45,13 @@ type ImmutableArray<T> = {
45
function narrowLiterals<T extends string>(array: Array<T>): Array<T>;
46
function narrowLiterals<T extends number>(array: Array<T>): Array<T>;
47
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() {};
57
```
0 commit comments