Skip to content
This repository was archived by the owner on Oct 15, 2018. It is now read-only.

Commit a96d355

Browse files
committed
Update readme.md
1 parent e2155a1 commit a96d355

File tree

3 files changed

+44
-18
lines changed

3 files changed

+44
-18
lines changed

gulpfile.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,12 @@ gulp.task("generate-readme", function(cb) {
191191
var readmeText = fs.readFileSync(path.join(__dirname, "resources/readme.txt"), "utf8");
192192
var tsTypeInfo = require("./dist/main");
193193
var readmeInfo = tsTypeInfo.getStringInfo(readmeCode);
194-
var cache = [];
194+
195+
console.log(readmeInfo.classes[0].staticProperties);
195196

196197
readmeText = readmeText
197198
.replace("{{Code}}", readmeCode)
198-
.replace("{{CodeOutput}}", JSON.stringify(readmeInfo, function(key, value) {
199-
if (typeof value === 'object' && value !== null) {
200-
if (cache.indexOf(value) !== -1) {
201-
// Circular reference found, discard key
202-
return;
203-
}
204-
// Store value in our collection
205-
cache.push(value);
206-
}
207-
return value;
208-
}));
199+
.replace("{{CodeOutput}}", JSON.stringify(readmeInfo));
209200

210201
fs.writeFile(path.join(__dirname, "readme.md"), readmeText, function(err) {
211202
if (err) throw err;

readme.md

+40-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function myDecorator(str: string) {
2929

3030
@myDecorator("My decorator value")
3131
export class MyClass {
32-
static myStaticProperty: string;
32+
static myStaticProperty: string | number;
3333

3434
myProperty = 253;
3535

@@ -64,7 +64,16 @@ console.log(TsTypeInfo.getFileInfo([ "V:/TestFile.ts" ]));
6464
"name": "str",
6565
"isOptional": false,
6666
"isRestParameter": false,
67-
"defaultExpression": null
67+
"defaultExpression": null,
68+
"typeExpression": {
69+
"text": "string",
70+
"types": [{
71+
"text": "string",
72+
"properties": [],
73+
"callSignatures": [],
74+
"typeArguments": []
75+
}]
76+
}
6877
}],
6978
"returnTypeExpression": {
7079
"types": [{
@@ -107,7 +116,16 @@ console.log(TsTypeInfo.getFileInfo([ "V:/TestFile.ts" ]));
107116
}],
108117
"typeParameters": [],
109118
"decorators": [],
110-
"scope": 0
119+
"scope": 0,
120+
"returnTypeExpression": {
121+
"text": "string",
122+
"types": [{
123+
"text": "string",
124+
"properties": [],
125+
"callSignatures": [],
126+
"typeArguments": []
127+
}]
128+
}
111129
}],
112130
"properties": [{
113131
"name": "myProperty",
@@ -124,14 +142,31 @@ console.log(TsTypeInfo.getFileInfo([ "V:/TestFile.ts" ]));
124142
"decorators": [],
125143
"scope": 0,
126144
"isAccessor": false,
127-
"isReadonly": false
145+
"isReadonly": false,
146+
"defaultExpression": {
147+
text: "253"
148+
}
128149
}],
129150
"staticMethods": [],
130151
"staticProperties": [{
131152
"name": "myStaticProperty",
132153
"isOptional": false,
133154
"decorators": [],
134-
"scope": 0
155+
"scope": 0,
156+
"typeExpression": {
157+
"text": "string | number",
158+
"types": [{
159+
"text": "string",
160+
"properties": [],
161+
"callSignatures": [],
162+
"typeArguments": []
163+
}, {
164+
"text": "number",
165+
"properties": [],
166+
"callSignatures": [],
167+
"typeArguments": []
168+
}]
169+
}
135170
}]
136171
}],
137172
"enums": [],

resources/readme-code.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function myDecorator(str: string) {
77

88
@myDecorator("My decorator value")
99
export class MyClass {
10-
static myStaticProperty: string;
10+
static myStaticProperty: string | number;
1111

1212
myProperty = 253;
1313

0 commit comments

Comments
 (0)