typescript
interface
interface Person {
name: string;
age: number;
}
let person: Person = Person
Class
npx tsx ./test_class.ts
class Person {
TYPE = "Person"
hello() {
console.log("hello from", this.TYPE)
}
}
class Student extends Person {
TYPE = "Student"
}
function main() {
const alice = new Student()
alice.hello()
}
main()