typescript "variable?: type" notation code example
Example: typescript "variable?: type" notation
// the "last" property is optional and can be undefined
function printName(obj: { first: string; last?: string }) { // ...}// Both OKprintName({ first: "Bob" });printName({ first: "Alice", last: "Alisson" });Try