Type "(string) => string" is incompatible with type "<T>(T) => T"
See original GitHub issueI’m not sure i doing it correctly but here it is
type Fn = <T>(value: T) => T
let fn: Fn = (s:string) => '2'
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Error using generic return type (incompatible types: cannot be ...
I have never used generics, so I'm a bit confused. $ javac Main.java Main.java:22: error: incompatible types: MyQueue cannot be converted to T...
Read more >How to Handle the Incompatible Types Error in Java - Rollbar
The Java incompatible types error happens when a value assigned to a variable or returned by a method is incompatible with the one...
Read more >Type 'T' is not assignable to type when Generic Anonymous ...
Type '(a: string) => string' is not assignable to type '<T>(a: T) => any'. Types of parameters 'a' and 'a' are incompatible. Type...
Read more >Generic Types | Flow
If you want something to have a generic type, annotate it. Otherwise, Flow may infer a type that is less polymorphic than you...
Read more >Documentation - Everyday Types - TypeScript
JavaScript has three very commonly used primitives: string , number , and ... When you don't specify a type, and TypeScript can't infer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Merciful12 is’t incorrect case. Without generic in function
test
you can call function with any parameter: