2 Matching Annotations
- Jan 2020
-
www.reddit.com www.reddit.com
-
That's the problem with therapy: The people who really need help are often the onesnot trusting others (as a result of bad experiences)not recognizing they have a problem in the first placebeing too scared to open up (or leave the house)being too exhausted to goless likely to be able to afford it. (That's only an issue in countries without a proper health care system.)
-
- Oct 2019
-
github.com github.com
-
function fn1<T extends string>(x: T): T { return "hello world!"; } How to resolve this error? Change to return "hello world" as T?
I wish someone would actually answer this question and recommend a general solution to this class of error.
It seems like "forcing" the type to be T with
return "hello world" as T
only masks the issue. It's still be possible to get type mismatches, as demonstrated in this example:So maybe we just can't safely return specific instances of T from functions like this...
-