For example, in typescript:
interface X = {
name: string;
}
const name = "Joe";
const y: X = {
name
}
// equivalent to
const z: X = {
name: name
}
AFAIK this only works because the variable name is "matched" to the expected property names of the interface. How is typescript/js accomplishing this under the hood?