Skip to content

Commit 63cf4bf

Browse files
committed
fix: tsc no longer filters * in docs
1 parent 62977b1 commit 63cf4bf

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ A `Validator` will always maintain a valid json schema representation of the typ
274274
The underlying json schema can always be accessed with `getSchema()`.
275275
###### Example:
276276
```typescript
277-
const stringValidator = new Validator<string>({ type: 'string' });
278-
const numberValidator = new Validator<number>({ type: 'number' });
279-
const strOrNum = new Validator<string | number>({ oneOf: [ { type: 'string' }, { type: 'number' } ]});
280-
const strOrNum2 = stringValidator.or(numberValidator);
281-
```
277+
const stringValidator = new Validator<string>({ type: 'string' });
278+
const numberValidator = new Validator<number>({ type: 'number' });
279+
const strOrNum = new Validator<string | number>({ oneOf: [ { type: 'string' }, { type: 'number' } ]});
280+
const strOrNum2 = stringValidator.or(numberValidator);
281+
```
282282

283283
### Validator.and
284284
Creates a new validator that is true whenever the data matches `this` _and_ `v`.

scripts/generateDocumentation.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,20 @@ const buildTypeInfoFromNode = (fileName: string, checker: tsc.TypeChecker, node:
6161
.map(tag => tag.text)
6262
.filter(text => !!text)[0];
6363

64+
const cleanedExample = example && example
65+
.split('\n')
66+
.map(line =>
67+
line.trimLeft().startsWith('*')
68+
? line.trimLeft().substr(1).trimLeft()
69+
: line
70+
)
71+
.join('\n');
72+
6473
const typeInfo: TypeInfo = {
74+
example: cleanedExample,
6575
typeName,
6676
parameterDocs,
6777
returnDocs: returnDocs[0],
68-
example,
6978
description,
7079
fileName,
7180
};

0 commit comments

Comments
 (0)