@@ -35,33 +35,35 @@ document.addEventListener('DOMContentLoaded', () => {
3535
3636
3737 // Actual editor and transpilation
38- let example = `// Declare exposed API
39- type Vector = [number, number, number];
40-
41- declare interface OnSpellStartEvent {
42- caster: Unit;
43- targetLocation: Vector;
44- }
45-
46- declare class Unit {
47- getLevel(): number;
48- isEnemy(other: Unit): boolean;
49- kill(): void;
50- }
51-
52- declare function print(...messages: any[]): void;
53- declare function FindUnitsInRadius(location: Vector, radius: number): Unit[];
54-
55- // Use declared API in code
56- function onSpellStart(event: OnSpellStartEvent): void {
57- const units = FindUnitsInRadius(event.targetLocation, 500);
58- const enemies = units.filter(unit => event.caster.isEnemy(unit));
59-
60- for (const unit of enemies) {
61- print(unit, unit.getLevel());
62- unit.kill();
63- }
64- }` ;
38+ let example = `/** @noSelfInFile */
39+
40+ // Declare exposed API
41+ type Vector = [number, number, number];
42+
43+ declare interface OnSpellStartEvent {
44+ caster: Unit;
45+ targetLocation: Vector;
46+ }
47+
48+ declare class Unit {
49+ getLevel(): number;
50+ isEnemy(other: Unit): boolean;
51+ kill(): void;
52+ }
53+
54+ declare function print(...messages: any[]): void;
55+ declare function FindUnitsInRadius(location: Vector, radius: number): Unit[];
56+
57+ // Use declared API in code
58+ function onSpellStart(event: OnSpellStartEvent): void {
59+ const units = FindUnitsInRadius(event.targetLocation, 500);
60+ const enemies = units.filter(unit => event.caster.isEnemy(unit));
61+
62+ for (const unit of enemies) {
63+ print(unit, unit.getLevel());
64+ unit.kill();
65+ }
66+ }` ;
6567
6668 var queryStringSrcStart = window . location . hash . indexOf ( "#src=" ) ;
6769 if ( queryStringSrcStart == 0 ) {
0 commit comments