Skip to content

Commit b0ecea4

Browse files
committed
Clarify some more types
1 parent 1aa10cb commit b0ecea4

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"declaration": true,
1010
"noImplicitAny": true,
1111
"suppressImplicitAnyIndexErrors": true,
12+
"strictNullChecks": false,
1213
"removeComments": true,
1314
"noLib": false,
1415
"preserveConstEnums": true,

typescript-json-schema.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export declare function getDefaultArgs(): {
99
usePropertyOrder: boolean;
1010
generateRequired: boolean;
1111
strictNullChecks: boolean;
12-
out: any;
12+
out: string;
1313
};
1414
export declare class JsonSchemaGenerator {
1515
private args;
@@ -33,7 +33,7 @@ export declare class JsonSchemaGenerator {
3333
usePropertyOrder: boolean;
3434
generateRequired: boolean;
3535
strictNullChecks: boolean;
36-
out: any;
36+
out: string;
3737
});
3838
readonly ReffedDefinitions: {
3939
[key: string]: any;
@@ -69,7 +69,7 @@ export declare function generateSchema(program: ts.Program, fullTypeName: string
6969
usePropertyOrder: boolean;
7070
generateRequired: boolean;
7171
strictNullChecks: boolean;
72-
out: any;
72+
out: string;
7373
}): any;
7474
export declare function programFromConfig(configFileName: string): ts.Program;
7575
export declare function exec(filePattern: string, fullTypeName: string, args?: {
@@ -82,6 +82,6 @@ export declare function exec(filePattern: string, fullTypeName: string, args?: {
8282
usePropertyOrder: boolean;
8383
generateRequired: boolean;
8484
strictNullChecks: boolean;
85-
out: any;
85+
out: string;
8686
}): void;
8787
export declare function run(): void;

typescript-json-schema.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function getDefaultArgs() {
1717
usePropertyOrder: false,
1818
generateRequired: false,
1919
strictNullChecks: false,
20-
out: undefined as string
20+
out: ""
2121
};
2222
}
2323

@@ -472,15 +472,15 @@ export class JsonSchemaGenerator {
472472
if (this.args.usePropertyOrder) {
473473
// propertyOrder is non-standard, but useful:
474474
// https://github.com/json-schema/json-schema/issues/87
475-
const propertyOrder = props.reduce((order, prop) => {
475+
const propertyOrder = props.reduce((order: string[], prop: ts.Symbol) => {
476476
order.push(prop.getName());
477477
return order;
478478
}, []);
479479

480480
definition.propertyOrder = propertyOrder;
481481
}
482482
if (this.args.generateRequired) {
483-
const requiredProps = props.reduce((required, prop) => {
483+
const requiredProps = props.reduce((required: string[], prop: ts.Symbol) => {
484484
if (!(prop.flags & ts.SymbolFlags.Optional) && !(<any>prop).mayBeUndefined) {
485485
required.push(prop.getName());
486486
}

0 commit comments

Comments
 (0)