typescript-json-schema
Advanced tools
Comparing version 0.59.0 to 0.60.0
23
api.md
@@ -610,2 +610,12 @@ _Auto-generated file. Updated with NPM deploy. Update manually with 'yarn docs'._ | ||
## [const-keyword](./test/programs/const-keyword) | ||
```ts | ||
const fn = <const T>(value: T) => | ||
({ value }); | ||
export type Object = ReturnType<typeof fn<"value">>; | ||
``` | ||
## [custom-dates](./test/programs/custom-dates) | ||
@@ -1279,2 +1289,13 @@ | ||
## [numeric-keys-and-others](./test/programs/numeric-keys-and-others) | ||
```ts | ||
interface NumericKeysAndOthers { | ||
[key: number]: number; | ||
a: string; | ||
b: boolean; | ||
} | ||
``` | ||
## [object-numeric-index](./test/programs/object-numeric-index) | ||
@@ -1896,3 +1917,3 @@ | ||
interface Foo { | ||
readonly childFoos: Foo & ChildFoo; | ||
readonly childFoos: Foo | ChildFoo; | ||
} | ||
@@ -1899,0 +1920,0 @@ ``` |
@@ -423,2 +423,3 @@ "use strict"; | ||
var _this = this; | ||
var _b; | ||
if (defaultNumberType === void 0) { defaultNumberType = this.args.defaultNumberType; } | ||
@@ -512,2 +513,5 @@ if (ignoreUndefined === void 0) { ignoreUndefined = false; } | ||
_a); | ||
if (!!((_b = Array.from(propertyType.members)) === null || _b === void 0 ? void 0 : _b.find(function (member) { return member[0] !== "__index"; }))) { | ||
this.getClassDefinition(propertyType, definition); | ||
} | ||
} | ||
@@ -827,4 +831,4 @@ else { | ||
var indexType = this.tc.getTypeOfSymbolAtLocation(indexSymbol, node); | ||
var isStringIndexed = indexType.flags === ts.TypeFlags.String; | ||
if (indexType.flags !== ts.TypeFlags.Number && !isStringIndexed) { | ||
var isIndexedObject = indexType.flags === ts.TypeFlags.String || indexType.flags === ts.TypeFlags.Number; | ||
if (indexType.flags !== ts.TypeFlags.Number && !isIndexedObject) { | ||
throw new Error("Not supported: IndexSignatureDeclaration with index symbol other than a number or a string"); | ||
@@ -850,5 +854,7 @@ } | ||
} | ||
if (isStringIndexed) { | ||
if (isIndexedObject) { | ||
definition.type = "object"; | ||
definition.additionalProperties = def; | ||
if (!Object.keys(definition.patternProperties || {}).length) { | ||
definition.additionalProperties = def; | ||
} | ||
} | ||
@@ -892,6 +898,6 @@ else { | ||
var requiredProps = props.reduce(function (required, prop) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
var def = {}; | ||
_this.parseCommentsIntoDefinition(prop, def, {}); | ||
var allUnionTypesFlags = ((_c = (_b = (_a = prop.type) === null || _a === void 0 ? void 0 : _a.types) === null || _b === void 0 ? void 0 : _b.map) === null || _c === void 0 ? void 0 : _c.call(_b, function (t) { return t.flags; })) || []; | ||
var allUnionTypesFlags = ((_d = (_c = (_b = (_a = prop.links) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.types) === null || _c === void 0 ? void 0 : _c.map) === null || _d === void 0 ? void 0 : _d.call(_c, function (t) { return t.flags; })) || []; | ||
if (!(prop.flags & ts.SymbolFlags.Optional) && | ||
@@ -1051,3 +1057,3 @@ !(prop.flags & ts.SymbolFlags.Method) && | ||
if (definition.type === undefined) { | ||
if (typ.flags & ts.TypeFlags.Union) { | ||
if (typ.flags & ts.TypeFlags.Union && (node === null || node.kind !== ts.SyntaxKind.EnumDeclaration)) { | ||
this.getUnionDefinition(typ, unionModifier, definition); | ||
@@ -1054,0 +1060,0 @@ } |
{ | ||
"name": "typescript-json-schema", | ||
"version": "0.59.0", | ||
"version": "0.60.0", | ||
"description": "typescript-json-schema generates JSON Schema files from your Typescript sources", | ||
@@ -50,3 +50,3 @@ "main": "dist/typescript-json-schema.js", | ||
"ts-node": "^10.9.1", | ||
"typescript": "~4.9.5", | ||
"typescript": "~5.1.0", | ||
"yargs": "^17.1.1" | ||
@@ -53,0 +53,0 @@ }, |
@@ -22,4 +22,4 @@ { | ||
"sourceMap": true, | ||
"watch": false, | ||
"typeRoots" : ["node_modules/@types"] | ||
"typeRoots" : ["node_modules/@types"], | ||
"ignoreDeprecations": "5.0" | ||
}, | ||
@@ -26,0 +26,0 @@ "include": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
247602
3436
+ Addedtypescript@5.1.6(transitive)
- Removedtypescript@4.9.5(transitive)
Updatedtypescript@~5.1.0