on master help sign in
Generate highlighted file on latest version
commite74719971153ad454be08e30adb98d0aba12ece9 authorparksb <parkgds@gmail.com> dateSun 4 Oct 2020, 20:39 (6 years ago) parentdf7ce88
1 file changed+107−107
tests/syntax-tests/highlighted/TypeScript/example.ts+107−107
tests/syntax-tests/highlighted/TypeScript/example.ts+107−107
@@ -1,110 +1,110 @@
1−let letNumber = 10;
2−const constNumber = 20;
3−
4−const bool: boolean = true;
5−const list: number[] = [1, 2, 3];
6−const array: Array<number> = [1, 2, 3];
7−const pair: [string, number] = ['hello', 10];
8−
9−for (let i = 0; i < list.length; i += 1) {
10− console.log(list[i]);
11−}
12−
13−if (bool) {
14− console.log('True');
15−} else {
16− console.log('False');
17−}
18−
19−const str: string = 'Jake';
20−const templateStr: string = `Hello, ${str}!`;
21−
1+let letNumber = 10;
2+const constNumber = 20;
3+
4+const bool: boolean = true;
5+const list: number[] = [1, 2, 3];
6+const array: Array<number> = [1, 2, 3];
7+const pair: [string, number] = ['hello', 10];
8+
9+for (let i = 0; i < list.length; i += 1) {
10+ console.log(list[i]);
11+}
12+
13+if (bool) {
14+ console.log('True');
15+} else {
16+ console.log('False');
17+}
18+
19+const str: string = 'Jake';
20+const templateStr: string = `Hello, ${str}!`;
21+
2222// A comment
23−
24−/*
23+
24+/*
2525 * Multiline comments
2626 * Multiline comments
27− */
28−
29−interface SquareConfig {
30− label: string;
31− color?: string;
32− width?: number;
33− [propName: string]: any;
34−}
35−
36−interface SearchFunc {
37− (source: string, subString: string): boolean;
38−}
39−
40−enum Color {
41− Red,
42− Green,
43−}
44−
45−type Easing = "ease-in" | "ease-out" | "ease-in-out";
46−
47−class Greeter {
48− private readonly greeting: string;
49−
50− constructor(message: string) {
51− this.greeting = message;
52− }
53−
54− greet() {
55− return "Hello, " + this.greeting;
56− }
57−}
58−
59−let greeter = new Greeter("world");
60−
61−class Animal {
62− move(distanceInMeters: number = 0) {
63− console.log(`Animal moved ${distanceInMeters}m.`);
64− }
65−}
66−
67−class Dog extends Animal {
68− bark() {
69− console.log("Woof! Woof!");
70− }
71−}
72−
73−const dog = new Dog();
74−dog.bark();
75−dog.move(10);
76−dog.bark();
77−
78−class Point {
79− x: number;
80− y: number;
81−}
82−
83−interface Point3d extends Point {
84− z: number;
85−}
86−
87−let point3d: Point3d = { x: 1, y: 2, z: 3 };
88−
89−function add(x, y) {
90− return x + y;
91−}
92−
93−let myAdd = function (x, y) {
94− return x + y;
95−};
96−
97−(function () {
98− console.log('IIFE');
99−}());
100−
101−function identity<T>(arg: T): T {
102− return arg;
103−}
104−
105−let myIdentity: <T>(arg: T) => T = identity;
106−
107−class GenericNumber<T> {
108− zeroValue: T;
109− add: (x: T, y: T) => T;
110−}
27+ */
28+
29+interface SquareConfig {
30+ label: string;
31+ color?: string;
32+ width?: number;
33+ [propName: string]: any;
34+}
35+
36+interface SearchFunc {
37+ (source: string, subString: string): boolean;
38+}
39+
40+enum Color {
41+ Red,
42+ Green,
43+}
44+
45+type Easing = "ease-in" | "ease-out" | "ease-in-out";
46+
47+class Greeter {
48+ private readonly greeting: string;
49+
50+ constructor(message: string) {
51+ this.greeting = message;
52+ }
53+
54+ greet() {
55+ return "Hello, " + this.greeting;
56+ }
57+}
58+
59+let greeter = new Greeter("world");
60+
61+class Animal {
62+ move(distanceInMeters: number = 0) {
63+ console.log(`Animal moved ${distanceInMeters}m.`);
64+ }
65+}
66+
67+class Dog extends Animal {
68+ bark() {
69+ console.log("Woof! Woof!");
70+ }
71+}
72+
73+const dog = new Dog();
74+dog.bark();
75+dog.move(10);
76+dog.bark();
77+
78+class Point {
79+ x: number;
80+ y: number;
81+}
82+
83+interface Point3d extends Point {
84+ z: number;
85+}
86+
87+let point3d: Point3d = { x: 1, y: 2, z: 3 };
88+
89+function add(x, y) {
90+ return x + y;
91+}
92+
93+let myAdd = function (x, y) {
94+ return x + y;
95+};
96+
97+(function () {
98+ console.log('IIFE');
99+}());
100+
101+function identity<T>(arg: T): T {
102+ return arg;
103+}
104+
105+let myIdentity: <T>(arg: T) => T = identity;
106+
107+class GenericNumber<T> {
108+ zeroValue: T;
109+ add: (x: T, y: T) => T;
110+}