0

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?

Kieran
  • 316
  • 5
  • 15

0 Answers0