2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-18 15:26:16 +00:00

Generate highlighted file on latest version

This commit is contained in:
parksb 2020-10-04 20:39:14 +09:00 committed by David Peter
parent df7ce883c7
commit e747199711

View File

@ -1,110 +1,110 @@
let letNumber = 10; let letNumber = 10;
const constNumber = 20; const constNumber = 20;

const bool: boolean = true; const bool: boolean = true;
const list: number[] = [1, 2, 3]; const list: number[] = [1, 2, 3];
const array: Array<number> = [1, 2, 3]; const array: Array<number> = [1, 2, 3];
const pair: [string, number] = ['hello', 10]; const pair: [string, number] = ['hello', 10];

for (let i = 0; i < list.length; i += 1) { for (let i = 0; i < list.length; i += 1) {
 console.log(list[i]);  console.log(list[i]);
} }

if (bool) { if (bool) {
 console.log('True');  console.log('True');
} else { } else {
 console.log('False');  console.log('False');
} }

const str: string = 'Jake'; const str: string = 'Jake';
const templateStr: string = `Hello, ${str}!`; const templateStr: string = `Hello, ${str}!`;

// A comment // A comment

/* /*
 * Multiline comments  * Multiline comments
 * Multiline comments  * Multiline comments
 */  */

interface SquareConfig { interface SquareConfig {
 label: string;  label: string;
 color?: string;  color?: string;
 width?: number;  width?: number;
 [propName: string]: any;  [propName: string]: any;
} }

interface SearchFunc { interface SearchFunc {
 (source: string, subString: string): boolean;  (source: string, subString: string): boolean;
} }

enum Color { enum Color {
 Red,  Red,
 Green,  Green,
} }

type Easing = "ease-in" | "ease-out" | "ease-in-out"; type Easing = "ease-in" | "ease-out" | "ease-in-out";

class Greeter { class Greeter {
 private readonly greeting: string;  private readonly greeting: string;

 constructor(message: string) {  constructor(message: string) {
 this.greeting = message;  this.greeting = message;
 }  }

 greet() {  greet() {
 return "Hello, " + this.greeting;  return "Hello, " + this.greeting;
 }  }
} }

let greeter = new Greeter("world"); let greeter = new Greeter("world");

class Animal { class Animal {
 move(distanceInMeters: number = 0) {  move(distanceInMeters: number = 0) {
 console.log(`Animal moved ${distanceInMeters}m.`);  console.log(`Animal moved ${distanceInMeters}m.`);
 }  }
} }

class Dog extends Animal { class Dog extends Animal {
 bark() {  bark() {
 console.log("Woof! Woof!");  console.log("Woof! Woof!");
 }  }
} }

const dog = new Dog(); const dog = new Dog();
dog.bark(); dog.bark();
dog.move(10); dog.move(10);
dog.bark(); dog.bark();

class Point { class Point {
 x: number;  x: number;
 y: number;  y: number;
} }

interface Point3d extends Point { interface Point3d extends Point {
 z: number;  z: number;
} }

let point3d: Point3d = { x: 1, y: 2, z: 3 }; let point3d: Point3d = { x: 1, y: 2, z: 3 };

function add(x, y) { function add(x, y) {
 return x + y;  return x + y;
} }

let myAdd = function (x, y) { let myAdd = function (x, y) {
 return x + y;  return x + y;
}; };

(function () { (function () {
 console.log('IIFE');  console.log('IIFE');
}()); }());

function identity<T>(arg: T): T { function identity<T>(arg: T): T {
 return arg;  return arg;
} }

let myIdentity: <T>(arg: T) => T = identity; let myIdentity: <T>(arg: T) => T = identity;

class GenericNumber<T> { class GenericNumber<T> {
 zeroValue: T;  zeroValue: T;
 add: (x: T, y: T) => T;  add: (x: T, y: T) => T;
} }