Skip to content

Commit ba137c8

Browse files
felixfbeckerdomoritz
authored andcommitted
Include proper declaration files in NPM package
1 parent 8ad40e5 commit ba137c8

9 files changed

+1447
-1405
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules
22
test/*.js
3+
test/*.d.ts
34
test/*.map
4-
.vscode/*.*
5+
.vscode/*.*

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.vscode/*.*
3+
typings/
4+
typescript-json-schema.ts
5+
test/schema.test.ts

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.2.0",
44
"description": "typescript-json-schema generates JSON Schema files from your Typescript sources",
55
"main": "typescript-json-schema.js",
6+
"typings": "typescript-json-schema.d.ts",
67
"bin": {
78
"typescript-json-schema": "./bin/typescript-json-schema"
89
},

test/schema.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {assert} from "chai";
22
import {version as TypescriptVersion, CompilerOptions} from "typescript";
3-
import {TJS} from "../typescript-json-schema";
3+
import * as TJS from "../typescript-json-schema";
44
import {readFileSync} from 'fs';
55
import {resolve} from 'path';
66

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"isolatedModules": false,
77
"experimentalDecorators": true,
88
"emitDecoratorMetadata": true,
9-
"declaration": false,
9+
"declaration": true,
1010
"noImplicitAny": false,
1111
"removeComments": true,
1212
"noLib": false,

typescript-json-schema.d.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import * as ts from "typescript";
2+
export declare function getDefaultArgs(): {
3+
useRef: boolean;
4+
useTypeAliasRef: boolean;
5+
useRootRef: boolean;
6+
useTitle: boolean;
7+
useDefaultProperties: boolean;
8+
disableExtraProperties: boolean;
9+
usePropertyOrder: boolean;
10+
generateRequired: boolean;
11+
strictNullChecks: boolean;
12+
out: any;
13+
};
14+
export declare function getProgramFromFiles(files: string[], compilerOptions?: ts.CompilerOptions): ts.Program;
15+
export declare function generateSchema(program: ts.Program, fullTypeName: string, args?: {
16+
useRef: boolean;
17+
useTypeAliasRef: boolean;
18+
useRootRef: boolean;
19+
useTitle: boolean;
20+
useDefaultProperties: boolean;
21+
disableExtraProperties: boolean;
22+
usePropertyOrder: boolean;
23+
generateRequired: boolean;
24+
strictNullChecks: boolean;
25+
out: any;
26+
}): any;
27+
export declare function programFromConfig(configFileName: string): ts.Program;
28+
export declare function exec(filePattern: string, fullTypeName: string, args?: {
29+
useRef: boolean;
30+
useTypeAliasRef: boolean;
31+
useRootRef: boolean;
32+
useTitle: boolean;
33+
useDefaultProperties: boolean;
34+
disableExtraProperties: boolean;
35+
usePropertyOrder: boolean;
36+
generateRequired: boolean;
37+
strictNullChecks: boolean;
38+
out: any;
39+
}): void;
40+
export declare function run(): void;

0 commit comments

Comments
 (0)