Came across a question regarding type interfaces that I cannot understand (unless it's incorrect)
methodName(): <Map<String, String>> {...
Is this return type incorrect and or perhaps meant to be <string, string>
?
Came across a question regarding type interfaces that I cannot understand (unless it's incorrect)
methodName(): <Map<String, String>> {...
Is this return type incorrect and or perhaps meant to be <string, string>
?
The only legitimate case I can think of that you are using the String
constructor (for some reason), and you therefore run into the fact that String
is not assignable to string
.
const str: string = new String('testing123')
// Type 'String' is not assignable to type 'string'.
// 'string' is a primitive, but 'String' is a wrapper object.
// Prefer using 'string' when possible.(2322)
All all likelihood, however, this is a mistake. If you change those to string
and everything still type checks fine, then it was almost certainly a mistake.