Say we have this example:
const a = 'Hello' as const
function f(){
return a[0]
}
const b = f()
The type of b is string, not 'H'. Is there a way to make it so? In practice, I want something like this:
type A = 'Hello'
type B = f(A)
So that if I need to change A, I don't need to change B too. I read about Generics but still don't know how to apply it. Getting first character in the string is just an example. The input variables can be arrays, objects, etc.