Test files › Source code › sample.ts
Sample TypeScript file (sample)
A TypeScript module using generics, a discriminated union, enums, decorators and JSX-free type syntax.
↓ Download sample.ts| Filename | sample.ts |
| Format | TypeScript |
| Size | 774 bytes (774 bytes) |
| MIME type | text/plain; charset=utf-8 |
| SHA-256 | 389cc0a1a1881fa69c8ae72735d23e0fbf782174c35110f59e85bd675e7bf8f1 |
What this file catchesHighlighters and parsers that treat .ts as plain JavaScript. The type annotations, generic angle brackets and "satisfies" operator are the constructs that break a JS-only tokeniser, usually by mistaking < and > for comparison.
Download & verify
curl -fsSL -o "sample.ts" "https://files.hexaqa.com/code/sample.ts"
curl -fsSL "https://files.hexaqa.com/code/sample.ts" | sha256sum
# expect: 389cc0a1a1881fa69c8ae72735d23e0fbf782174c35110f59e85bd675e7bf8f1