I made this simple code:
const testHashMap = {
hello: "Hi",
test: "Hey",
blabla: "Halo"
}
const inputFromField : string = "hello";
alert(testHashMap[inputFromField]);
But the last line doesn't work because it demands that inputFromField will be from type "hello" | "test" | "blabla" and not a general string, how can I insist to use string? as it should be an input from the user in the future.