mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 00:51:56 +00:00 
			
		
		
		
	Add basic typescript test file
This commit is contained in:
		
							
								
								
									
										110
									
								
								tests/syntax-tests/highlighted/TypeScript/example.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								tests/syntax-tests/highlighted/TypeScript/example.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,110 @@
 | 
			
		||||
[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mletNumber[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m10[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mconstNumber[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m20[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mbool[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mboolean[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mlist[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m[[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255marray[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mArray[0m[38;2;248;248;242m<[0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mpair[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m][0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;230;219;116m'[0m[38;2;230;219;116mhello[0m[38;2;230;219;116m'[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m10[0m[38;2;248;248;242m][0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;249;38;114mfor[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;255;255;255mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m<[0m[38;2;248;248;242m [0m[38;2;255;255;255mlist[0m[38;2;248;248;242m.[0m[38;2;248;248;242mlength[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;255;255;255mi[0m[38;2;248;248;242m [0m[38;2;249;38;114m+=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[3;38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlog[0m[38;2;255;255;255m([0m[38;2;255;255;255mlist[0m[38;2;248;248;242m[[0m[38;2;255;255;255mi[0m[38;2;248;248;242m][0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mbool[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[3;38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlog[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116mTrue[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[3;38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlog[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116mFalse[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mstr[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116mJake[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mtemplateStr[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m`[0m[38;2;230;219;116mHello, [0m[38;2;230;219;116m${[0m[38;2;255;255;255mstr[0m[38;2;230;219;116m}[0m[38;2;230;219;116m![0m[38;2;230;219;116m`[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;117;113;94m//[0m[38;2;117;113;94m A comment[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;117;113;94m/*[0m[38;2;117;113;94m[0m
 | 
			
		||||
[38;2;117;113;94m * Multiline comments[0m
 | 
			
		||||
[38;2;117;113;94m * Multiline comments[0m
 | 
			
		||||
[38;2;117;113;94m [0m[38;2;117;113;94m*/[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239minterface[0m[38;2;248;248;242m [0m[38;2;166;226;46mSquareConfig[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242mlabel[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242mcolor[0m[38;2;249;38;114m?[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242mwidth[0m[38;2;249;38;114m?[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242m[[0m[3;38;2;253;151;31mpropName[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m][0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46many[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239minterface[0m[38;2;248;248;242m [0m[38;2;166;226;46mSearchFunc[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242m([0m[3;38;2;253;151;31msource[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;253;151;31msubString[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m)[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mboolean[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239menum[0m[38;2;248;248;242m [0m[38;2;166;226;46mColor[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;255;255;255mRed[0m[38;2;248;248;242m,[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;255;255;255mGreen[0m[38;2;248;248;242m,[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mtype[0m[38;2;248;248;242m [0m[38;2;166;226;46mEasing[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mease-in[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mease-out[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m|[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mease-in-out[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mGreeter[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m [0m[38;2;249;38;114mreadonly[0m[38;2;248;248;242m [0m[38;2;248;248;242mgreeting[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[3;38;2;102;217;239mconstructor[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mmessage[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mstring[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m    [0m[38;2;255;255;255mthis[0m[38;2;248;248;242m.[0m[38;2;255;255;255mgreeting[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mmessage[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;166;226;46mgreet[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m    [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mHello, [0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255mthis[0m[38;2;248;248;242m.[0m[38;2;255;255;255mgreeting[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mgreeter[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[38;2;166;226;46mGreeter[0m[38;2;255;255;255m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mworld[0m[38;2;230;219;116m"[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mAnimal[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;166;226;46mmove[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mdistanceInMeters[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m    [0m[3;38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlog[0m[38;2;255;255;255m([0m[38;2;230;219;116m`[0m[38;2;230;219;116mAnimal moved [0m[38;2;230;219;116m${[0m[38;2;255;255;255mdistanceInMeters[0m[38;2;230;219;116m}[0m[38;2;230;219;116mm.[0m[38;2;230;219;116m`[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mDog[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[4;38;2;166;226;46mAnimal[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;166;226;46mbark[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m    [0m[3;38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlog[0m[38;2;255;255;255m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mWoof! Woof![0m[38;2;230;219;116m"[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mdog[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m [0m[38;2;166;226;46mDog[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;255;255;255mdog[0m[38;2;248;248;242m.[0m[38;2;166;226;46mbark[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;255;255;255mdog[0m[38;2;248;248;242m.[0m[38;2;102;217;239mmove[0m[38;2;255;255;255m([0m[38;2;190;132;255m10[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;255;255;255mdog[0m[38;2;248;248;242m.[0m[38;2;166;226;46mbark[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mPoint[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242mx[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242my[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239minterface[0m[38;2;248;248;242m [0m[38;2;166;226;46mPoint3d[0m[38;2;248;248;242m [0m[38;2;249;38;114mextends[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mPoint[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242mz[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mnumber[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mpoint3d[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mPoint3d[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;248;248;242mx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;248;248;242my[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;248;248;242mz[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46madd[0m[38;2;248;248;242m([0m[3;38;2;253;151;31mx[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;253;151;31my[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;255;255;255mx[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255my[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;166;226;46mmyAdd[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[3;38;2;253;151;31mx[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;253;151;31my[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;255;255;255mx[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;248;248;242m [0m[38;2;255;255;255my[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;255;255;255m([0m[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[3;38;2;166;226;46mconsole[0m[38;2;248;248;242m.[0m[38;2;102;217;239mlog[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116mIIFE[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46midentity[0m[38;2;248;248;242m<[0m[38;2;166;226;46mT[0m[38;2;248;248;242m>[0m[38;2;248;248;242m([0m[3;38;2;253;151;31marg[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m)[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;255;255;255marg[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;166;226;46mmyIdentity[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m<[0m[38;2;166;226;46mT[0m[38;2;248;248;242m>[0m[38;2;248;248;242m([0m[3;38;2;253;151;31marg[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255midentity[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m[0m
 | 
			
		||||
[3;38;2;102;217;239mclass[0m[38;2;248;248;242m [0m[38;2;166;226;46mGenericNumber[0m[38;2;248;248;242m<[0m[38;2;166;226;46mT[0m[38;2;248;248;242m>[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;248;248;242mzeroValue[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m  [0m[38;2;166;226;46madd[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[3;38;2;253;151;31mx[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;253;151;31my[0m[38;2;249;38;114m:[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;166;226;46mT[0m[38;2;248;248;242m;[0m[38;2;248;248;242m[0m
 | 
			
		||||
[38;2;248;248;242m}[0m[38;2;248;248;242m[0m
 | 
			
		||||
							
								
								
									
										17
									
								
								tests/syntax-tests/source/TypeScript/LICENSE.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								tests/syntax-tests/source/TypeScript/LICENSE.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
The MIT License (MIT)
 | 
			
		||||
Copyright (c) Microsoft Corporation
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 
 | 
			
		||||
associated documentation files (the "Software"), to deal in the Software without restriction, 
 | 
			
		||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 | 
			
		||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 
 | 
			
		||||
subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all copies or substantial 
 | 
			
		||||
portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 
 | 
			
		||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 | 
			
		||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
 | 
			
		||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 | 
			
		||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
							
								
								
									
										110
									
								
								tests/syntax-tests/source/TypeScript/example.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								tests/syntax-tests/source/TypeScript/example.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,110 @@
 | 
			
		||||
let letNumber = 10;
 | 
			
		||||
const constNumber = 20;
 | 
			
		||||
 | 
			
		||||
const bool: boolean = true;
 | 
			
		||||
const list: number[] = [1, 2, 3];
 | 
			
		||||
const array: Array<number> = [1, 2, 3];
 | 
			
		||||
const pair: [string, number] = ['hello', 10];
 | 
			
		||||
 | 
			
		||||
for (let i = 0; i < list.length; i += 1) {
 | 
			
		||||
  console.log(list[i]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (bool) {
 | 
			
		||||
  console.log('True');
 | 
			
		||||
} else {
 | 
			
		||||
  console.log('False');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const str: string = 'Jake';
 | 
			
		||||
const templateStr: string = `Hello, ${str}!`;
 | 
			
		||||
 | 
			
		||||
// A comment
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Multiline comments
 | 
			
		||||
 * Multiline comments
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
interface SquareConfig {
 | 
			
		||||
  label: string;
 | 
			
		||||
  color?: string;
 | 
			
		||||
  width?: number;
 | 
			
		||||
  [propName: string]: any;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface SearchFunc {
 | 
			
		||||
  (source: string, subString: string): boolean;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
enum Color {
 | 
			
		||||
  Red,
 | 
			
		||||
  Green,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Easing = "ease-in" | "ease-out" | "ease-in-out";
 | 
			
		||||
 | 
			
		||||
class Greeter {
 | 
			
		||||
  private readonly greeting: string;
 | 
			
		||||
 | 
			
		||||
  constructor(message: string) {
 | 
			
		||||
    this.greeting = message;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  greet() {
 | 
			
		||||
    return "Hello, " + this.greeting;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
let greeter = new Greeter("world");
 | 
			
		||||
 | 
			
		||||
class Animal {
 | 
			
		||||
  move(distanceInMeters: number = 0) {
 | 
			
		||||
    console.log(`Animal moved ${distanceInMeters}m.`);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Dog extends Animal {
 | 
			
		||||
  bark() {
 | 
			
		||||
    console.log("Woof! Woof!");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const dog = new Dog();
 | 
			
		||||
dog.bark();
 | 
			
		||||
dog.move(10);
 | 
			
		||||
dog.bark();
 | 
			
		||||
 | 
			
		||||
class Point {
 | 
			
		||||
  x: number;
 | 
			
		||||
  y: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface Point3d extends Point {
 | 
			
		||||
  z: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
let point3d: Point3d = { x: 1, y: 2, z: 3 };
 | 
			
		||||
 | 
			
		||||
function add(x, y) {
 | 
			
		||||
  return x + y;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
let myAdd = function (x, y) {
 | 
			
		||||
  return x + y;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
(function () {
 | 
			
		||||
  console.log('IIFE');
 | 
			
		||||
}());
 | 
			
		||||
 | 
			
		||||
function identity<T>(arg: T): T {
 | 
			
		||||
  return arg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
let myIdentity: <T>(arg: T) => T = identity;
 | 
			
		||||
 | 
			
		||||
class GenericNumber<T> {
 | 
			
		||||
  zeroValue: T;
 | 
			
		||||
  add: (x: T, y: T) => T;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user