Open this example in the interactive library
Source code
interface Named {
name: string;
}
console.log(
(() => {
class Team implements Named {
constructor(public name: string) {}
}
return new Team("Ops").name;
})(),
);
Sample output
Ops
