Skip to content

Commit 8b2470f

Browse files
Add es6 example
1 parent 877eb0a commit 8b2470f

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

examples/basic/src/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export module moduleFunction
175175
export function createSomething() {
176176
return {
177177
foo: 'bar',
178-
doSomething: (a:number) => a +1,
178+
doSomething: (a:number) => a + 1,
179179
doAnotherThing: () => {}
180180
};
181181
}

examples/es6/run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
cd ${0%/*}
3+
node ../../bin/typedoc --module commonjs --target ES6 --out doc/ src/

examples/es6/run.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
set curr_dir=%cd%
3+
chdir /D "%~dp0"
4+
5+
node ..\..\bin\typedoc --module commonjs --target ES6 --out doc\ src\
6+
7+
chdir /D "%curr_dir%"

examples/es6/src/es6.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
function f() {
2+
let total = 0;
3+
let x = 5;
4+
for (let x = 1; x < 10; x++) {
5+
total += x;
6+
}
7+
console.log(x);
8+
}
9+
10+
var rectangle = { height: 20, width: 10 };
11+
var areaMessage = `Rectangle area is ${rectangle.height * rectangle.width}`;
12+
13+
14+
class Foo
15+
{
16+
/**
17+
* A function that returns an object.
18+
* Also no type information is given, the object should be correctly reflected.
19+
*/
20+
createSomething() {
21+
return {
22+
foo: 'bar',
23+
doSomething(a:number) { return a + 1},
24+
doAnotherThing() {}
25+
};
26+
}
27+
}

0 commit comments

Comments
 (0)