Port some amount of code to typescript

This commit is contained in:
David Majdandžić
2023-03-28 01:45:53 +02:00
parent 630c8a1004
commit a26dbcc231
10 changed files with 1954 additions and 1 deletions

30
WebsocketTest.ts Normal file
View File

@@ -0,0 +1,30 @@
// @ts-ignore
const Websocket = require('ws');
const ws = new Websocket('ws://localhost:8191');
ws.on('open', function open() {
ws.send('something');
});
interface Animal {
doNoise(): void;
}
class Dog implements Animal {
doNoise(): void {
console.log("woof");
}
}
class Cat implements Animal {
doNoise(): void {
console.log("meow");
}
}
const dog = new Dog();
dog.doNoise();
const cat = new Cat();
cat.doNoise();
let animals: Animal[] = [dog, cat];
animals.forEach(animal => animal.doNoise());