mirror of
https://github.com/maxmx03/dracula.nvim.git
synced 2026-09-10 07:26:19 -04:00
42 lines
755 B
TypeScript
42 lines
755 B
TypeScript
/*
|
|
* Once upon a time...
|
|
*/
|
|
|
|
interface VampireProps {
|
|
location: string;
|
|
birthDate: number;
|
|
deathDate: number;
|
|
weaknesses: string[];
|
|
}
|
|
|
|
class Vampire {
|
|
location: string;
|
|
birthDate: number;
|
|
deathDate: number;
|
|
weaknesses: string[];
|
|
|
|
constructor(props: VampireProps) {
|
|
this.location = props.location;
|
|
this.birthDate = props.birthDate;
|
|
this.deathDate = props.deathDate;
|
|
this.weaknesses = props.weaknesses;
|
|
}
|
|
|
|
get age(): number {
|
|
return this.calcAge();
|
|
}
|
|
|
|
calcAge(): number {
|
|
return this.deathDate - this.birthDate;
|
|
}
|
|
}
|
|
|
|
// ...there was a guy named Vlad
|
|
|
|
const Dracula: VampireProps = new Vampire({
|
|
location: 'Transylvania',
|
|
birthDate: 1428,
|
|
deathDate: 1476,
|
|
weaknesses: ['Sunlight', 'Garlic'],
|
|
});
|