-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtestTypeScriptMix.ts
More file actions
86 lines (61 loc) · 1.58 KB
/
testTypeScriptMix.ts
File metadata and controls
86 lines (61 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Begin ---------------------------------------------------------------
function addNumbers(a: number, b: number) : number {
return a + b;
}
let subNumber = (a: number, b: number) : number => {
return a - b;
}
const mulNumber = (a: number, b: number) : number => {
return a * b;
}
interface Point {
x: number;
y: number;
}
function logPoint(p: Point) {
System.log(`${p.x}, ${p.y}`);
}
enum CardinalDirections {
North,
East,
South,
West
}
class Person {
private name: string;
public constructor(name: string) {
this.name = name;
}
public getName(): string {
return this.name;
}
}
function getVcenters() {
const vcenters: Array<string> = VcPlugin.allRegisteredInstances;
vcenters.forEach( (vcenter) => {
System.log(vcenter);
});
}
function main() {
const sum: number = addNumbers(10, 15);
const diff: number = subNumber(15, 10);
const prod: number = mulNumber(4, 4);
System.log("Sum of the two numbers is: " + sum);
System.warn("Diff of the two numbers is: " + diff);
System.error("Product of the two numbers is: " + prod);
const point = { x: 12, y: 26 };
logPoint(point);
let multilineString: string = `
This is a multiline string.
In TypeScript, we use backticks.
It makes the code more readable.
`;
System.log(multilineString)
let currentDirection = CardinalDirections.North;
System.log("Current Direction is: " + currentDirection);
const person = new Person("Stefan");
System.log(person.getName());
getVcenters();
}
main();
// End -----------------------------------------------------------------