typescript Erased Structural Types

The solution for “typescript Erased Structural Types” can be found here. The following code will assist you in solving the problem.

interface Pointlike {
x: number;
y: number;
}
interface Named {
name: string;
}
 
function logPoint(point: Pointlike) {
console.log(“x = ” + point.x + “, y = ” + point.y);
}
 
function logName(x: Named) {
console.log(“Hello, ” + x.name);
}
 
const obj = {
x: 0,
y: 0,
name: “Origin”,
};
 
logPoint(obj);
logName(obj);
Try

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in