quicktype 17.0.4 → 17.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/CompressedJSONFromStream.js +38 -26
- package/dist/cli/GraphQLIntrospection.js +41 -33
- package/dist/cli/TypeSource.d.ts +1 -1
- package/dist/cli/URLGrammar.js +3 -4
- package/dist/cli/index.js +364 -363
- package/dist/quicktype-core/Annotation.js +0 -2
- package/dist/quicktype-core/ConvenienceRenderer.d.ts +17 -17
- package/dist/quicktype-core/ConvenienceRenderer.js +81 -104
- package/dist/quicktype-core/DateTime.js +0 -1
- package/dist/quicktype-core/DeclarationIR.d.ts +1 -1
- package/dist/quicktype-core/DeclarationIR.js +10 -13
- package/dist/quicktype-core/EncodedMarkovChain.js +0 -1
- package/dist/quicktype-core/GatherNames.js +25 -47
- package/dist/quicktype-core/Graph.d.ts +2 -2
- package/dist/quicktype-core/Graph.js +19 -23
- package/dist/quicktype-core/GraphRewriting.d.ts +2 -2
- package/dist/quicktype-core/GraphRewriting.js +54 -65
- package/dist/quicktype-core/MakeTransformations.js +22 -23
- package/dist/quicktype-core/MarkovChain.d.ts +3 -3
- package/dist/quicktype-core/MarkovChain.js +8 -9
- package/dist/quicktype-core/Messages.d.ts +3 -3
- package/dist/quicktype-core/Messages.js +3 -8
- package/dist/quicktype-core/Naming.d.ts +11 -11
- package/dist/quicktype-core/Naming.js +61 -76
- package/dist/quicktype-core/Renderer.d.ts +6 -6
- package/dist/quicktype-core/Renderer.js +17 -34
- package/dist/quicktype-core/RendererOptions.d.ts +5 -5
- package/dist/quicktype-core/RendererOptions.js +3 -6
- package/dist/quicktype-core/Run.d.ts +9 -9
- package/dist/quicktype-core/Run.js +67 -72
- package/dist/quicktype-core/Source.d.ts +3 -3
- package/dist/quicktype-core/Source.js +18 -19
- package/dist/quicktype-core/TargetLanguage.d.ts +10 -10
- package/dist/quicktype-core/TargetLanguage.js +2 -6
- package/dist/quicktype-core/Transformers.d.ts +25 -25
- package/dist/quicktype-core/Transformers.js +66 -94
- package/dist/quicktype-core/Type.d.ts +43 -41
- package/dist/quicktype-core/Type.js +71 -96
- package/dist/quicktype-core/TypeBuilder.d.ts +2 -2
- package/dist/quicktype-core/TypeBuilder.js +47 -53
- package/dist/quicktype-core/TypeGraph.d.ts +4 -4
- package/dist/quicktype-core/TypeGraph.js +40 -49
- package/dist/quicktype-core/TypeUtils.d.ts +2 -2
- package/dist/quicktype-core/TypeUtils.js +22 -23
- package/dist/quicktype-core/UnifyClasses.js +12 -16
- package/dist/quicktype-core/UnionBuilder.d.ts +3 -3
- package/dist/quicktype-core/UnionBuilder.js +30 -33
- package/dist/quicktype-core/attributes/AccessorNames.d.ts +2 -2
- package/dist/quicktype-core/attributes/AccessorNames.js +17 -18
- package/dist/quicktype-core/attributes/Constraints.d.ts +3 -3
- package/dist/quicktype-core/attributes/Constraints.js +4 -8
- package/dist/quicktype-core/attributes/Description.js +5 -6
- package/dist/quicktype-core/attributes/EnumValues.js +3 -4
- package/dist/quicktype-core/attributes/StringTypes.d.ts +1 -1
- package/dist/quicktype-core/attributes/StringTypes.js +21 -24
- package/dist/quicktype-core/attributes/TypeAttributes.d.ts +3 -3
- package/dist/quicktype-core/attributes/TypeAttributes.js +10 -12
- package/dist/quicktype-core/attributes/TypeNames.d.ts +9 -9
- package/dist/quicktype-core/attributes/TypeNames.js +21 -49
- package/dist/quicktype-core/attributes/URIAttributes.d.ts +1 -1
- package/dist/quicktype-core/attributes/URIAttributes.js +6 -10
- package/dist/quicktype-core/index.js +125 -128
- package/dist/quicktype-core/input/CompressedJSON.d.ts +7 -7
- package/dist/quicktype-core/input/CompressedJSON.js +54 -49
- package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +13 -5
- package/dist/quicktype-core/input/Inference.d.ts +2 -2
- package/dist/quicktype-core/input/Inference.js +17 -25
- package/dist/quicktype-core/input/Inputs.d.ts +2 -2
- package/dist/quicktype-core/input/Inputs.js +54 -38
- package/dist/quicktype-core/input/JSONSchemaInput.d.ts +11 -11
- package/dist/quicktype-core/input/JSONSchemaInput.js +523 -503
- package/dist/quicktype-core/input/JSONSchemaStore.d.ts +1 -1
- package/dist/quicktype-core/input/JSONSchemaStore.js +35 -24
- package/dist/quicktype-core/input/PostmanCollection.js +1 -2
- package/dist/quicktype-core/input/io/NodeIO.js +44 -55
- package/dist/quicktype-core/input/io/get-stream/index.js +2 -6
- package/dist/quicktype-core/language/All.js +2 -3
- package/dist/quicktype-core/language/CPlusPlus.d.ts +12 -9
- package/dist/quicktype-core/language/CPlusPlus.js +249 -251
- package/dist/quicktype-core/language/CSharp.d.ts +7 -7
- package/dist/quicktype-core/language/CSharp.js +72 -82
- package/dist/quicktype-core/language/Crystal.d.ts +2 -2
- package/dist/quicktype-core/language/Crystal.js +17 -18
- package/dist/quicktype-core/language/Dart.d.ts +4 -4
- package/dist/quicktype-core/language/Dart.js +34 -36
- package/dist/quicktype-core/language/Elm.d.ts +6 -6
- package/dist/quicktype-core/language/Elm.js +45 -47
- package/dist/quicktype-core/language/Golang.d.ts +4 -4
- package/dist/quicktype-core/language/Golang.js +20 -23
- package/dist/quicktype-core/language/Haskell.d.ts +5 -5
- package/dist/quicktype-core/language/Haskell.js +23 -25
- package/dist/quicktype-core/language/JSONSchema.d.ts +3 -3
- package/dist/quicktype-core/language/JSONSchema.js +16 -17
- package/dist/quicktype-core/language/Java.d.ts +2 -2
- package/dist/quicktype-core/language/Java.js +97 -97
- package/dist/quicktype-core/language/JavaScript.d.ts +7 -7
- package/dist/quicktype-core/language/JavaScript.js +17 -19
- package/dist/quicktype-core/language/JavaScriptPropTypes.js +13 -15
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +11 -12
- package/dist/quicktype-core/language/Kotlin.d.ts +2 -2
- package/dist/quicktype-core/language/Kotlin.js +37 -39
- package/dist/quicktype-core/language/Objective-C.d.ts +3 -3
- package/dist/quicktype-core/language/Objective-C.js +41 -45
- package/dist/quicktype-core/language/Php.d.ts +2 -2
- package/dist/quicktype-core/language/Php.js +41 -66
- package/dist/quicktype-core/language/Pike.d.ts +1 -1
- package/dist/quicktype-core/language/Pike.js +17 -18
- package/dist/quicktype-core/language/Python.d.ts +8 -8
- package/dist/quicktype-core/language/Python.js +64 -63
- package/dist/quicktype-core/language/Rust.d.ts +2 -2
- package/dist/quicktype-core/language/Rust.js +19 -21
- package/dist/quicktype-core/language/Swift.d.ts +7 -7
- package/dist/quicktype-core/language/Swift.js +804 -807
- package/dist/quicktype-core/language/TypeScriptFlow.d.ts +7 -7
- package/dist/quicktype-core/language/TypeScriptFlow.js +26 -28
- package/dist/quicktype-core/language/ruby/index.d.ts +4 -4
- package/dist/quicktype-core/language/ruby/index.js +24 -49
- package/dist/quicktype-core/language/ruby/keywords.js +0 -1
- package/dist/quicktype-core/rewrites/CombineClasses.js +8 -9
- package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +1 -1
- package/dist/quicktype-core/rewrites/ExpandStrings.js +17 -18
- package/dist/quicktype-core/rewrites/FlattenStrings.js +6 -7
- package/dist/quicktype-core/rewrites/FlattenUnions.js +8 -9
- package/dist/quicktype-core/rewrites/InferMaps.js +10 -11
- package/dist/quicktype-core/rewrites/ReplaceObjectType.js +7 -8
- package/dist/quicktype-core/rewrites/ResolveIntersections.js +67 -68
- package/dist/quicktype-core/support/Acronyms.js +1 -3
- package/dist/quicktype-core/support/Chance.js +0 -10
- package/dist/quicktype-core/support/Converters.js +0 -1
- package/dist/quicktype-core/support/Strings.d.ts +4 -4
- package/dist/quicktype-core/support/Strings.js +16 -17
- package/dist/quicktype-core/support/Support.d.ts +1 -1
- package/dist/quicktype-core/support/Support.js +6 -30
- package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +4 -4
- package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -1
- package/dist/quicktype-graphql-input/index.d.ts +1 -1
- package/dist/quicktype-graphql-input/index.js +212 -229
- package/dist/quicktype-typescript-input/index.js +4 -28
- package/package.json +19 -25
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TypeBuilder = exports.getNoStringTypeMapping = exports.stringTypeMappingGet = exports.provenanceTypeAttributeKind = void 0;
|
|
4
3
|
const collection_utils_1 = require("collection-utils");
|
|
5
4
|
const Type_1 = require("./Type");
|
|
6
5
|
const TypeGraph_1 = require("./TypeGraph");
|
|
@@ -17,7 +16,7 @@ class ProvenanceTypeAttributeKind extends TypeAttributes_1.TypeAttributeKind {
|
|
|
17
16
|
return true;
|
|
18
17
|
}
|
|
19
18
|
combine(arr) {
|
|
20
|
-
return
|
|
19
|
+
return collection_utils_1.setUnionManyInto(new Set(), arr);
|
|
21
20
|
}
|
|
22
21
|
makeInferred(p) {
|
|
23
22
|
return p;
|
|
@@ -46,34 +45,30 @@ function getNoStringTypeMapping() {
|
|
|
46
45
|
}
|
|
47
46
|
exports.getNoStringTypeMapping = getNoStringTypeMapping;
|
|
48
47
|
class TypeBuilder {
|
|
49
|
-
_stringTypeMapping;
|
|
50
|
-
canonicalOrder;
|
|
51
|
-
_allPropertiesOptional;
|
|
52
|
-
_addProvenanceAttributes;
|
|
53
|
-
typeGraph;
|
|
54
|
-
topLevels = new Map();
|
|
55
|
-
types = [];
|
|
56
|
-
typeAttributes = [];
|
|
57
|
-
_addedForwardingIntersection = false;
|
|
58
48
|
constructor(typeGraphSerial, _stringTypeMapping, canonicalOrder, _allPropertiesOptional, _addProvenanceAttributes, inheritsProvenanceAttributes) {
|
|
59
49
|
this._stringTypeMapping = _stringTypeMapping;
|
|
60
50
|
this.canonicalOrder = canonicalOrder;
|
|
61
51
|
this._allPropertiesOptional = _allPropertiesOptional;
|
|
62
52
|
this._addProvenanceAttributes = _addProvenanceAttributes;
|
|
63
|
-
|
|
53
|
+
this.topLevels = new Map();
|
|
54
|
+
this.types = [];
|
|
55
|
+
this.typeAttributes = [];
|
|
56
|
+
this._addedForwardingIntersection = false;
|
|
57
|
+
this._typeForIdentity = new collection_utils_1.EqualityMap();
|
|
58
|
+
Support_1.assert(!_addProvenanceAttributes || !inheritsProvenanceAttributes, "We can't both inherit as well as add provenance");
|
|
64
59
|
this.typeGraph = new TypeGraph_1.TypeGraph(this, typeGraphSerial, _addProvenanceAttributes || inheritsProvenanceAttributes);
|
|
65
60
|
}
|
|
66
61
|
addTopLevel(name, tref) {
|
|
67
62
|
// assert(t.typeGraph === this.typeGraph, "Adding top-level to wrong type graph");
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
Support_1.assert(!this.topLevels.has(name), "Trying to add top-level with existing name");
|
|
64
|
+
Support_1.assert(this.types[TypeGraph_1.typeRefIndex(tref)] !== undefined, "Trying to add a top-level type that doesn't exist (yet?)");
|
|
70
65
|
this.topLevels.set(name, tref);
|
|
71
66
|
}
|
|
72
67
|
reserveTypeRef() {
|
|
73
68
|
const index = this.types.length;
|
|
74
69
|
// console.log(`reserving ${index}`);
|
|
75
70
|
this.types.push(undefined);
|
|
76
|
-
const tref =
|
|
71
|
+
const tref = TypeGraph_1.makeTypeRef(this.typeGraph, index);
|
|
77
72
|
const attributes = this._addProvenanceAttributes
|
|
78
73
|
? exports.provenanceTypeAttributeKind.makeAttributes(new Set([index]))
|
|
79
74
|
: TypeAttributes_1.emptyTypeAttributes;
|
|
@@ -83,7 +78,7 @@ class TypeBuilder {
|
|
|
83
78
|
assertTypeRefGraph(tref) {
|
|
84
79
|
if (tref === undefined)
|
|
85
80
|
return;
|
|
86
|
-
|
|
81
|
+
TypeGraph_1.assertTypeRefGraph(tref, this.typeGraph);
|
|
87
82
|
}
|
|
88
83
|
assertTypeRefSetGraph(trefs) {
|
|
89
84
|
if (trefs === undefined)
|
|
@@ -91,7 +86,7 @@ class TypeBuilder {
|
|
|
91
86
|
trefs.forEach(tref => this.assertTypeRefGraph(tref));
|
|
92
87
|
}
|
|
93
88
|
filterTypeAttributes(t, attributes) {
|
|
94
|
-
const filtered =
|
|
89
|
+
const filtered = collection_utils_1.mapFilter(attributes, (_, k) => k.appliesToTypeKind(t.kind));
|
|
95
90
|
if (attributes.size !== filtered.size) {
|
|
96
91
|
this.setLostTypeAttributes();
|
|
97
92
|
}
|
|
@@ -99,22 +94,22 @@ class TypeBuilder {
|
|
|
99
94
|
}
|
|
100
95
|
commitType(tref, t) {
|
|
101
96
|
this.assertTypeRefGraph(tref);
|
|
102
|
-
const index =
|
|
97
|
+
const index = TypeGraph_1.typeRefIndex(tref);
|
|
103
98
|
// const name = names !== undefined ? ` ${names.combinedName}` : "";
|
|
104
99
|
// console.log(`committing ${t.kind}${name} to ${index}`);
|
|
105
|
-
|
|
100
|
+
Support_1.assert(this.types[index] === undefined, "A type index was committed twice");
|
|
106
101
|
this.types[index] = t;
|
|
107
102
|
this.typeAttributes[index] = this.filterTypeAttributes(t, this.typeAttributes[index]);
|
|
108
103
|
}
|
|
109
104
|
addType(forwardingRef, creator, attributes) {
|
|
110
105
|
if (forwardingRef !== undefined) {
|
|
111
106
|
this.assertTypeRefGraph(forwardingRef);
|
|
112
|
-
|
|
107
|
+
Support_1.assert(this.types[TypeGraph_1.typeRefIndex(forwardingRef)] === undefined);
|
|
113
108
|
}
|
|
114
109
|
const tref = forwardingRef !== undefined ? forwardingRef : this.reserveTypeRef();
|
|
115
110
|
if (attributes !== undefined) {
|
|
116
|
-
const index =
|
|
117
|
-
this.typeAttributes[index] =
|
|
111
|
+
const index = TypeGraph_1.typeRefIndex(tref);
|
|
112
|
+
this.typeAttributes[index] = TypeAttributes_1.combineTypeAttributes("union", this.typeAttributes[index], attributes);
|
|
118
113
|
}
|
|
119
114
|
const t = creator(tref);
|
|
120
115
|
this.commitType(tref, t);
|
|
@@ -123,7 +118,7 @@ class TypeBuilder {
|
|
|
123
118
|
typeAtIndex(index) {
|
|
124
119
|
const maybeType = this.types[index];
|
|
125
120
|
if (maybeType === undefined) {
|
|
126
|
-
return
|
|
121
|
+
return Support_1.panic("Trying to deref an undefined type in a type builder");
|
|
127
122
|
}
|
|
128
123
|
return maybeType;
|
|
129
124
|
}
|
|
@@ -134,22 +129,22 @@ class TypeBuilder {
|
|
|
134
129
|
}
|
|
135
130
|
addAttributes(tref, attributes) {
|
|
136
131
|
this.assertTypeRefGraph(tref);
|
|
137
|
-
const index =
|
|
132
|
+
const index = TypeGraph_1.typeRefIndex(tref);
|
|
138
133
|
const existingAttributes = this.typeAttributes[index];
|
|
139
|
-
|
|
134
|
+
Support_1.assert(collection_utils_1.iterableEvery(attributes, ([k, v]) => {
|
|
140
135
|
if (!k.inIdentity)
|
|
141
136
|
return true;
|
|
142
137
|
const existing = existingAttributes.get(k);
|
|
143
138
|
if (existing === undefined)
|
|
144
139
|
return false;
|
|
145
|
-
return
|
|
140
|
+
return collection_utils_1.areEqual(existing, v);
|
|
146
141
|
}), "Can't add different identity type attributes to an existing type");
|
|
147
142
|
const maybeType = this.types[index];
|
|
148
143
|
if (maybeType !== undefined) {
|
|
149
144
|
attributes = this.filterTypeAttributes(maybeType, attributes);
|
|
150
145
|
}
|
|
151
|
-
const nonIdentityAttributes =
|
|
152
|
-
this.typeAttributes[index] =
|
|
146
|
+
const nonIdentityAttributes = collection_utils_1.mapFilter(attributes, (_, k) => !k.inIdentity);
|
|
147
|
+
this.typeAttributes[index] = TypeAttributes_1.combineTypeAttributes("union", existingAttributes, nonIdentityAttributes);
|
|
153
148
|
}
|
|
154
149
|
finish() {
|
|
155
150
|
this.typeGraph.freeze(this.topLevels, this.types.map(Support_1.defined), this.typeAttributes);
|
|
@@ -170,7 +165,6 @@ class TypeBuilder {
|
|
|
170
165
|
get didAddForwardingIntersection() {
|
|
171
166
|
return this._addedForwardingIntersection;
|
|
172
167
|
}
|
|
173
|
-
_typeForIdentity = new collection_utils_1.EqualityMap();
|
|
174
168
|
registerTypeForIdentity(identity, tref) {
|
|
175
169
|
if (identity === undefined)
|
|
176
170
|
return;
|
|
@@ -195,7 +189,7 @@ class TypeBuilder {
|
|
|
195
189
|
// we found the type based on its identity, i.e. all the identity
|
|
196
190
|
// attributes must be in there already, and we have a check that
|
|
197
191
|
// asserts that no identity attributes are added later.
|
|
198
|
-
this.addAttributes(result,
|
|
192
|
+
this.addAttributes(result, collection_utils_1.mapFilter(attributes, (_, k) => !k.inIdentity));
|
|
199
193
|
}
|
|
200
194
|
return result;
|
|
201
195
|
}
|
|
@@ -207,35 +201,35 @@ class TypeBuilder {
|
|
|
207
201
|
this.registerTypeForIdentity(t.identity, t.typeRef);
|
|
208
202
|
}
|
|
209
203
|
getPrimitiveType(kind, maybeAttributes, forwardingRef) {
|
|
210
|
-
const attributes =
|
|
204
|
+
const attributes = collection_utils_1.withDefault(maybeAttributes, TypeAttributes_1.emptyTypeAttributes);
|
|
211
205
|
// FIXME: Why do date/time types need a StringTypes attribute?
|
|
212
206
|
// FIXME: Remove this from here and put it into flattenStrings
|
|
213
207
|
let stringTypes = kind === "string" ? undefined : StringTypes_1.StringTypes.unrestricted;
|
|
214
|
-
if (
|
|
208
|
+
if (Type_1.isPrimitiveStringTypeKind(kind) && kind !== "string") {
|
|
215
209
|
kind = stringTypeMappingGet(this._stringTypeMapping, kind);
|
|
216
210
|
}
|
|
217
211
|
if (kind === "string") {
|
|
218
212
|
return this.getStringType(attributes, stringTypes, forwardingRef);
|
|
219
213
|
}
|
|
220
|
-
return this.getOrAddType(() =>
|
|
214
|
+
return this.getOrAddType(() => Type_1.primitiveTypeIdentity(kind, attributes), tr => new Type_1.PrimitiveType(tr, this.typeGraph, kind), attributes, forwardingRef);
|
|
221
215
|
}
|
|
222
216
|
getStringType(attributes, stringTypes, forwardingRef) {
|
|
223
|
-
const existingStringTypes =
|
|
224
|
-
|
|
217
|
+
const existingStringTypes = collection_utils_1.mapFind(attributes, (_, k) => k === StringTypes_1.stringTypesTypeAttributeKind);
|
|
218
|
+
Support_1.assert((stringTypes === undefined) !== (existingStringTypes === undefined), "Must instantiate string type with one enum case attribute");
|
|
225
219
|
if (existingStringTypes === undefined) {
|
|
226
|
-
attributes =
|
|
220
|
+
attributes = TypeAttributes_1.combineTypeAttributes("union", attributes, StringTypes_1.stringTypesTypeAttributeKind.makeAttributes(Support_1.defined(stringTypes)));
|
|
227
221
|
}
|
|
228
|
-
return this.getOrAddType(() =>
|
|
222
|
+
return this.getOrAddType(() => Type_1.primitiveTypeIdentity("string", attributes), tr => new Type_1.PrimitiveType(tr, this.typeGraph, "string"), attributes, forwardingRef);
|
|
229
223
|
}
|
|
230
224
|
getEnumType(attributes, cases, forwardingRef) {
|
|
231
|
-
return this.getOrAddType(() =>
|
|
225
|
+
return this.getOrAddType(() => Type_1.enumTypeIdentity(attributes, cases), tr => new Type_1.EnumType(tr, this.typeGraph, cases), attributes, forwardingRef);
|
|
232
226
|
}
|
|
233
227
|
makeClassProperty(tref, isOptional) {
|
|
234
228
|
return new Type_1.ClassProperty(tref, this.typeGraph, isOptional);
|
|
235
229
|
}
|
|
236
230
|
getUniqueObjectType(attributes, properties, additionalProperties, forwardingRef) {
|
|
237
231
|
this.assertTypeRefGraph(additionalProperties);
|
|
238
|
-
properties =
|
|
232
|
+
properties = collection_utils_1.definedMap(properties, p => this.modifyPropertiesIfNecessary(p));
|
|
239
233
|
return this.addType(forwardingRef, tref => new Type_1.ObjectType(tref, this.typeGraph, "object", true, properties, additionalProperties), attributes);
|
|
240
234
|
}
|
|
241
235
|
getUniqueMapType(forwardingRef) {
|
|
@@ -243,13 +237,13 @@ class TypeBuilder {
|
|
|
243
237
|
}
|
|
244
238
|
getMapType(attributes, values, forwardingRef) {
|
|
245
239
|
this.assertTypeRefGraph(values);
|
|
246
|
-
return this.getOrAddType(() =>
|
|
240
|
+
return this.getOrAddType(() => Type_1.mapTypeIdentify(attributes, values), tr => new Type_1.MapType(tr, this.typeGraph, values), attributes, forwardingRef);
|
|
247
241
|
}
|
|
248
242
|
setObjectProperties(ref, properties, additionalProperties) {
|
|
249
243
|
this.assertTypeRefGraph(additionalProperties);
|
|
250
|
-
const type =
|
|
244
|
+
const type = TypeGraph_1.derefTypeRef(ref, this.typeGraph);
|
|
251
245
|
if (!(type instanceof Type_1.ObjectType)) {
|
|
252
|
-
return
|
|
246
|
+
return Support_1.panic("Tried to set properties of non-object type");
|
|
253
247
|
}
|
|
254
248
|
type.setProperties(this.modifyPropertiesIfNecessary(properties), additionalProperties);
|
|
255
249
|
this.registerType(type);
|
|
@@ -259,13 +253,13 @@ class TypeBuilder {
|
|
|
259
253
|
}
|
|
260
254
|
getArrayType(attributes, items, forwardingRef) {
|
|
261
255
|
this.assertTypeRefGraph(items);
|
|
262
|
-
return this.getOrAddType(() =>
|
|
256
|
+
return this.getOrAddType(() => Type_1.arrayTypeIdentity(attributes, items), tr => new Type_1.ArrayType(tr, this.typeGraph, items), attributes, forwardingRef);
|
|
263
257
|
}
|
|
264
258
|
setArrayItems(ref, items) {
|
|
265
259
|
this.assertTypeRefGraph(items);
|
|
266
|
-
const type =
|
|
260
|
+
const type = TypeGraph_1.derefTypeRef(ref, this.typeGraph);
|
|
267
261
|
if (!(type instanceof Type_1.ArrayType)) {
|
|
268
|
-
return
|
|
262
|
+
return Support_1.panic("Tried to set items of non-array type");
|
|
269
263
|
}
|
|
270
264
|
type.setItems(items);
|
|
271
265
|
this.registerType(type);
|
|
@@ -273,26 +267,26 @@ class TypeBuilder {
|
|
|
273
267
|
modifyPropertiesIfNecessary(properties) {
|
|
274
268
|
properties.forEach(p => this.assertTypeRefGraph(p.typeRef));
|
|
275
269
|
if (this.canonicalOrder) {
|
|
276
|
-
properties =
|
|
270
|
+
properties = collection_utils_1.mapSortByKey(properties);
|
|
277
271
|
}
|
|
278
272
|
if (this._allPropertiesOptional) {
|
|
279
|
-
properties =
|
|
273
|
+
properties = collection_utils_1.mapMap(properties, cp => this.makeClassProperty(cp.typeRef, true));
|
|
280
274
|
}
|
|
281
275
|
return properties;
|
|
282
276
|
}
|
|
283
277
|
getClassType(attributes, properties, forwardingRef) {
|
|
284
278
|
properties = this.modifyPropertiesIfNecessary(properties);
|
|
285
|
-
return this.getOrAddType(() =>
|
|
279
|
+
return this.getOrAddType(() => Type_1.classTypeIdentity(attributes, properties), tr => new Type_1.ClassType(tr, this.typeGraph, false, properties), attributes, forwardingRef);
|
|
286
280
|
}
|
|
287
281
|
// FIXME: Maybe just distinguish between this and `getClassType`
|
|
288
282
|
// via a flag? That would make `ClassType.map` simpler.
|
|
289
283
|
getUniqueClassType(attributes, isFixed, properties, forwardingRef) {
|
|
290
|
-
properties =
|
|
284
|
+
properties = collection_utils_1.definedMap(properties, p => this.modifyPropertiesIfNecessary(p));
|
|
291
285
|
return this.addType(forwardingRef, tref => new Type_1.ClassType(tref, this.typeGraph, isFixed, properties), attributes);
|
|
292
286
|
}
|
|
293
287
|
getUnionType(attributes, members, forwardingRef) {
|
|
294
288
|
this.assertTypeRefSetGraph(members);
|
|
295
|
-
return this.getOrAddType(() =>
|
|
289
|
+
return this.getOrAddType(() => Type_1.unionTypeIdentity(attributes, members), tr => new Type_1.UnionType(tr, this.typeGraph, members), attributes, forwardingRef);
|
|
296
290
|
}
|
|
297
291
|
// FIXME: why do we sometimes call this with defined members???
|
|
298
292
|
getUniqueUnionType(attributes, members, forwardingRef) {
|
|
@@ -301,7 +295,7 @@ class TypeBuilder {
|
|
|
301
295
|
}
|
|
302
296
|
getIntersectionType(attributes, members, forwardingRef) {
|
|
303
297
|
this.assertTypeRefSetGraph(members);
|
|
304
|
-
return this.getOrAddType(() =>
|
|
298
|
+
return this.getOrAddType(() => Type_1.intersectionTypeIdentity(attributes, members), tr => new Type_1.IntersectionType(tr, this.typeGraph, members), attributes, forwardingRef);
|
|
305
299
|
}
|
|
306
300
|
// FIXME: why do we sometimes call this with defined members???
|
|
307
301
|
getUniqueIntersectionType(attributes, members, forwardingRef) {
|
|
@@ -310,9 +304,9 @@ class TypeBuilder {
|
|
|
310
304
|
}
|
|
311
305
|
setSetOperationMembers(ref, members) {
|
|
312
306
|
this.assertTypeRefSetGraph(members);
|
|
313
|
-
const type =
|
|
307
|
+
const type = TypeGraph_1.derefTypeRef(ref, this.typeGraph);
|
|
314
308
|
if (!(type instanceof Type_1.UnionType || type instanceof Type_1.IntersectionType)) {
|
|
315
|
-
return
|
|
309
|
+
return Support_1.panic("Tried to set members of non-set-operation type");
|
|
316
310
|
}
|
|
317
311
|
type.setMembers(members);
|
|
318
312
|
this.registerType(type);
|
|
@@ -4,7 +4,7 @@ import { TypeBuilder, StringTypeMapping } from "./TypeBuilder";
|
|
|
4
4
|
import { GraphRewriteBuilder, BaseGraphRewriteBuilder } from "./GraphRewriting";
|
|
5
5
|
import { Graph } from "./Graph";
|
|
6
6
|
import { TypeAttributeKind, TypeAttributes } from "./attributes/TypeAttributes";
|
|
7
|
-
export type TypeRef = number;
|
|
7
|
+
export declare type TypeRef = number;
|
|
8
8
|
export declare function isTypeRef(x: any): x is TypeRef;
|
|
9
9
|
export declare function makeTypeRef(graph: TypeGraph, index: number): TypeRef;
|
|
10
10
|
export declare function typeRefIndex(tref: TypeRef): number;
|
|
@@ -48,10 +48,10 @@ export declare class TypeGraph {
|
|
|
48
48
|
private _parents;
|
|
49
49
|
private _printOnRewrite;
|
|
50
50
|
constructor(typeBuilder: TypeBuilder, serial: number, _haveProvenanceAttributes: boolean);
|
|
51
|
-
private
|
|
52
|
-
|
|
51
|
+
private readonly isFrozen;
|
|
52
|
+
readonly attributeStore: TypeAttributeStore;
|
|
53
53
|
freeze(topLevels: ReadonlyMap<string, TypeRef>, types: Type[], typeAttributes: (TypeAttributes | undefined)[]): void;
|
|
54
|
-
|
|
54
|
+
readonly topLevels: ReadonlyMap<string, Type>;
|
|
55
55
|
typeAtIndex(index: number): Type;
|
|
56
56
|
atIndex(index: number): [Type, TypeAttributes];
|
|
57
57
|
private filterTypes;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeIndirectionIntersections = exports.optionalToNullable = exports.noneToAny = exports.TypeGraph = exports.TypeAttributeStoreView = exports.TypeAttributeStore = exports.typeAndAttributesForTypeRef = exports.attributesForTypeRef = exports.derefTypeRef = exports.assertTypeRefGraph = exports.typeRefIndex = exports.makeTypeRef = exports.isTypeRef = void 0;
|
|
4
3
|
const collection_utils_1 = require("collection-utils");
|
|
5
4
|
const Type_1 = require("./Type");
|
|
6
5
|
const TypeUtils_1 = require("./TypeUtils");
|
|
@@ -20,7 +19,7 @@ function isTypeRef(x) {
|
|
|
20
19
|
}
|
|
21
20
|
exports.isTypeRef = isTypeRef;
|
|
22
21
|
function makeTypeRef(graph, index) {
|
|
23
|
-
|
|
22
|
+
Support_1.assert(index <= indexMask, "Too many types in graph");
|
|
24
23
|
return ((graph.serial & serialMask) << indexBits) | index;
|
|
25
24
|
}
|
|
26
25
|
exports.makeTypeRef = makeTypeRef;
|
|
@@ -29,7 +28,7 @@ function typeRefIndex(tref) {
|
|
|
29
28
|
}
|
|
30
29
|
exports.typeRefIndex = typeRefIndex;
|
|
31
30
|
function assertTypeRefGraph(tref, graph) {
|
|
32
|
-
|
|
31
|
+
Support_1.assert(((tref >> indexBits) & serialMask) === (graph.serial & serialMask), "Mixing the wrong type reference and graph");
|
|
33
32
|
}
|
|
34
33
|
exports.assertTypeRefGraph = assertTypeRefGraph;
|
|
35
34
|
function getGraph(graphOrBuilder) {
|
|
@@ -56,12 +55,10 @@ function typeAndAttributesForTypeRef(tref, graphOrBuilder) {
|
|
|
56
55
|
}
|
|
57
56
|
exports.typeAndAttributesForTypeRef = typeAndAttributesForTypeRef;
|
|
58
57
|
class TypeAttributeStore {
|
|
59
|
-
_typeGraph;
|
|
60
|
-
_values;
|
|
61
|
-
_topLevelValues = new Map();
|
|
62
58
|
constructor(_typeGraph, _values) {
|
|
63
59
|
this._typeGraph = _typeGraph;
|
|
64
60
|
this._values = _values;
|
|
61
|
+
this._topLevelValues = new Map();
|
|
65
62
|
}
|
|
66
63
|
getTypeIndex(t) {
|
|
67
64
|
const tref = t.typeRef;
|
|
@@ -109,8 +106,6 @@ class TypeAttributeStore {
|
|
|
109
106
|
}
|
|
110
107
|
exports.TypeAttributeStore = TypeAttributeStore;
|
|
111
108
|
class TypeAttributeStoreView {
|
|
112
|
-
_attributeStore;
|
|
113
|
-
_definition;
|
|
114
109
|
constructor(_attributeStore, _definition) {
|
|
115
110
|
this._attributeStore = _attributeStore;
|
|
116
111
|
this._definition = _definition;
|
|
@@ -125,40 +120,36 @@ class TypeAttributeStoreView {
|
|
|
125
120
|
return this._attributeStore.tryGet(this._definition, t);
|
|
126
121
|
}
|
|
127
122
|
get(t) {
|
|
128
|
-
return
|
|
123
|
+
return Support_1.defined(this.tryGet(t));
|
|
129
124
|
}
|
|
130
125
|
tryGetForTopLevel(name) {
|
|
131
126
|
return this._attributeStore.tryGetForTopLevel(this._definition, name);
|
|
132
127
|
}
|
|
133
128
|
getForTopLevel(name) {
|
|
134
|
-
return
|
|
129
|
+
return Support_1.defined(this.tryGetForTopLevel(name));
|
|
135
130
|
}
|
|
136
131
|
}
|
|
137
132
|
exports.TypeAttributeStoreView = TypeAttributeStoreView;
|
|
138
133
|
class TypeGraph {
|
|
139
|
-
serial;
|
|
140
|
-
_haveProvenanceAttributes;
|
|
141
|
-
_typeBuilder;
|
|
142
|
-
_attributeStore = undefined;
|
|
143
|
-
// FIXME: OrderedMap? We lose the order in PureScript right now, though,
|
|
144
|
-
// and maybe even earlier in the TypeScript driver.
|
|
145
|
-
_topLevels = new Map();
|
|
146
|
-
_types;
|
|
147
|
-
_parents = undefined;
|
|
148
|
-
_printOnRewrite = false;
|
|
149
134
|
constructor(typeBuilder, serial, _haveProvenanceAttributes) {
|
|
150
135
|
this.serial = serial;
|
|
151
136
|
this._haveProvenanceAttributes = _haveProvenanceAttributes;
|
|
137
|
+
this._attributeStore = undefined;
|
|
138
|
+
// FIXME: OrderedMap? We lose the order in PureScript right now, though,
|
|
139
|
+
// and maybe even earlier in the TypeScript driver.
|
|
140
|
+
this._topLevels = new Map();
|
|
141
|
+
this._parents = undefined;
|
|
142
|
+
this._printOnRewrite = false;
|
|
152
143
|
this._typeBuilder = typeBuilder;
|
|
153
144
|
}
|
|
154
145
|
get isFrozen() {
|
|
155
146
|
return this._typeBuilder === undefined;
|
|
156
147
|
}
|
|
157
148
|
get attributeStore() {
|
|
158
|
-
return
|
|
149
|
+
return Support_1.defined(this._attributeStore);
|
|
159
150
|
}
|
|
160
151
|
freeze(topLevels, types, typeAttributes) {
|
|
161
|
-
|
|
152
|
+
Support_1.assert(!this.isFrozen, "Tried to freeze TypeGraph a second time");
|
|
162
153
|
for (const t of types) {
|
|
163
154
|
assertTypeRefGraph(t.typeRef, this);
|
|
164
155
|
}
|
|
@@ -169,24 +160,24 @@ class TypeGraph {
|
|
|
169
160
|
// either a _typeBuilder or a _types.
|
|
170
161
|
this._types = types;
|
|
171
162
|
this._typeBuilder = undefined;
|
|
172
|
-
this._topLevels =
|
|
163
|
+
this._topLevels = collection_utils_1.mapMap(topLevels, tref => derefTypeRef(tref, this));
|
|
173
164
|
}
|
|
174
165
|
get topLevels() {
|
|
175
|
-
|
|
166
|
+
Support_1.assert(this.isFrozen, "Cannot get top-levels from a non-frozen graph");
|
|
176
167
|
return this._topLevels;
|
|
177
168
|
}
|
|
178
169
|
typeAtIndex(index) {
|
|
179
170
|
if (this._typeBuilder !== undefined) {
|
|
180
171
|
return this._typeBuilder.typeAtIndex(index);
|
|
181
172
|
}
|
|
182
|
-
return
|
|
173
|
+
return Support_1.defined(this._types)[index];
|
|
183
174
|
}
|
|
184
175
|
atIndex(index) {
|
|
185
176
|
if (this._typeBuilder !== undefined) {
|
|
186
177
|
return this._typeBuilder.atIndex(index);
|
|
187
178
|
}
|
|
188
179
|
const t = this.typeAtIndex(index);
|
|
189
|
-
return [t,
|
|
180
|
+
return [t, Support_1.defined(this._attributeStore).attributesForType(t)];
|
|
190
181
|
}
|
|
191
182
|
filterTypes(predicate) {
|
|
192
183
|
const seen = new Set();
|
|
@@ -213,10 +204,10 @@ class TypeGraph {
|
|
|
213
204
|
}
|
|
214
205
|
allNamedTypesSeparated() {
|
|
215
206
|
const types = this.allNamedTypes();
|
|
216
|
-
return
|
|
207
|
+
return TypeUtils_1.separateNamedTypes(types);
|
|
217
208
|
}
|
|
218
209
|
allProvenance() {
|
|
219
|
-
|
|
210
|
+
Support_1.assert(this._haveProvenanceAttributes);
|
|
220
211
|
const view = new TypeAttributeStoreView(this.attributeStore, TypeBuilder_1.provenanceTypeAttributeKind);
|
|
221
212
|
const sets = Array.from(this.allTypesUnordered()).map(t => {
|
|
222
213
|
const maybeSet = view.tryGet(t);
|
|
@@ -225,7 +216,7 @@ class TypeGraph {
|
|
|
225
216
|
return new Set();
|
|
226
217
|
});
|
|
227
218
|
const result = new Set();
|
|
228
|
-
|
|
219
|
+
collection_utils_1.setUnionManyInto(result, sets);
|
|
229
220
|
return result;
|
|
230
221
|
}
|
|
231
222
|
setPrintOnRewrite() {
|
|
@@ -237,9 +228,9 @@ class TypeGraph {
|
|
|
237
228
|
const oldProvenance = this.allProvenance();
|
|
238
229
|
const newProvenance = newGraph.allProvenance();
|
|
239
230
|
if (oldProvenance.size !== newProvenance.size) {
|
|
240
|
-
const difference =
|
|
231
|
+
const difference = collection_utils_1.setSubtract(oldProvenance, newProvenance);
|
|
241
232
|
const indexes = Array.from(difference);
|
|
242
|
-
return
|
|
233
|
+
return Messages_1.messageError("IRTypeAttributesNotPropagated", { count: difference.size, indexes });
|
|
243
234
|
}
|
|
244
235
|
}
|
|
245
236
|
printRewrite(title) {
|
|
@@ -279,17 +270,17 @@ class TypeGraph {
|
|
|
279
270
|
newGraph.setPrintOnRewrite();
|
|
280
271
|
newGraph.printGraph();
|
|
281
272
|
}
|
|
282
|
-
|
|
273
|
+
Support_1.assert(!builder.didAddForwardingIntersection);
|
|
283
274
|
return newGraph;
|
|
284
275
|
}
|
|
285
276
|
garbageCollect(alphabetizeProperties, debugPrintReconstitution) {
|
|
286
|
-
const newGraph = this.remap("GC",
|
|
277
|
+
const newGraph = this.remap("GC", TypeBuilder_1.getNoStringTypeMapping(), alphabetizeProperties, new Map(), debugPrintReconstitution, true);
|
|
287
278
|
return newGraph;
|
|
288
279
|
}
|
|
289
280
|
rewriteFixedPoint(alphabetizeProperties, debugPrintReconstitution) {
|
|
290
281
|
let graph = this;
|
|
291
282
|
for (;;) {
|
|
292
|
-
const newGraph = this.rewrite("fixed-point",
|
|
283
|
+
const newGraph = this.rewrite("fixed-point", TypeBuilder_1.getNoStringTypeMapping(), alphabetizeProperties, [], debugPrintReconstitution, Support_1.mustNotHappen, true);
|
|
293
284
|
if (graph.allTypesUnordered().size === newGraph.allTypesUnordered().size) {
|
|
294
285
|
return graph;
|
|
295
286
|
}
|
|
@@ -297,16 +288,16 @@ class TypeGraph {
|
|
|
297
288
|
}
|
|
298
289
|
}
|
|
299
290
|
allTypesUnordered() {
|
|
300
|
-
|
|
301
|
-
return new Set(
|
|
291
|
+
Support_1.assert(this.isFrozen, "Tried to get all graph types before it was frozen");
|
|
292
|
+
return new Set(Support_1.defined(this._types));
|
|
302
293
|
}
|
|
303
294
|
makeGraph(invertDirection, childrenOfType) {
|
|
304
|
-
return new Graph_1.Graph(
|
|
295
|
+
return new Graph_1.Graph(Support_1.defined(this._types), invertDirection, childrenOfType);
|
|
305
296
|
}
|
|
306
297
|
getParentsOfType(t) {
|
|
307
298
|
assertTypeRefGraph(t.typeRef, this);
|
|
308
299
|
if (this._parents === undefined) {
|
|
309
|
-
const parents =
|
|
300
|
+
const parents = Support_1.defined(this._types).map(_ => new Set());
|
|
310
301
|
for (const p of this.allTypesUnordered()) {
|
|
311
302
|
for (const c of p.getChildren()) {
|
|
312
303
|
const index = c.index;
|
|
@@ -318,7 +309,7 @@ class TypeGraph {
|
|
|
318
309
|
return this._parents[t.index];
|
|
319
310
|
}
|
|
320
311
|
printGraph() {
|
|
321
|
-
const types =
|
|
312
|
+
const types = Support_1.defined(this._types);
|
|
322
313
|
for (let i = 0; i < types.length; i++) {
|
|
323
314
|
const t = types[i];
|
|
324
315
|
const parts = [];
|
|
@@ -341,13 +332,13 @@ class TypeGraph {
|
|
|
341
332
|
}
|
|
342
333
|
exports.TypeGraph = TypeGraph;
|
|
343
334
|
function noneToAny(graph, stringTypeMapping, debugPrintReconstitution) {
|
|
344
|
-
const noneTypes =
|
|
335
|
+
const noneTypes = collection_utils_1.setFilter(graph.allTypesUnordered(), t => t.kind === "none");
|
|
345
336
|
if (noneTypes.size === 0) {
|
|
346
337
|
return graph;
|
|
347
338
|
}
|
|
348
|
-
|
|
339
|
+
Support_1.assert(noneTypes.size === 1, "Cannot have more than one none type");
|
|
349
340
|
return graph.rewrite("none to any", stringTypeMapping, false, [Array.from(noneTypes)], debugPrintReconstitution, (types, builder, forwardingRef) => {
|
|
350
|
-
const attributes =
|
|
341
|
+
const attributes = TypeUtils_1.combineTypeAttributesOfTypes("union", types);
|
|
351
342
|
const tref = builder.getPrimitiveType("any", attributes, forwardingRef);
|
|
352
343
|
return tref;
|
|
353
344
|
});
|
|
@@ -355,7 +346,7 @@ function noneToAny(graph, stringTypeMapping, debugPrintReconstitution) {
|
|
|
355
346
|
exports.noneToAny = noneToAny;
|
|
356
347
|
function optionalToNullable(graph, stringTypeMapping, debugPrintReconstitution) {
|
|
357
348
|
function rewriteClass(c, builder, forwardingRef) {
|
|
358
|
-
const properties =
|
|
349
|
+
const properties = collection_utils_1.mapMap(c.getProperties(), (p, name) => {
|
|
359
350
|
const t = p.type;
|
|
360
351
|
let ref;
|
|
361
352
|
if (!p.isOptional || t.isNullable) {
|
|
@@ -365,7 +356,7 @@ function optionalToNullable(graph, stringTypeMapping, debugPrintReconstitution)
|
|
|
365
356
|
const nullType = builder.getPrimitiveType("null");
|
|
366
357
|
let members;
|
|
367
358
|
if (t instanceof Type_1.UnionType) {
|
|
368
|
-
members =
|
|
359
|
+
members = collection_utils_1.setMap(t.members, m => builder.reconstituteType(m)).add(nullType);
|
|
369
360
|
}
|
|
370
361
|
else {
|
|
371
362
|
members = new Set([builder.reconstituteType(t), nullType]);
|
|
@@ -382,14 +373,14 @@ function optionalToNullable(graph, stringTypeMapping, debugPrintReconstitution)
|
|
|
382
373
|
return builder.getClassType(c.getAttributes(), properties, forwardingRef);
|
|
383
374
|
}
|
|
384
375
|
}
|
|
385
|
-
const classesWithOptional =
|
|
376
|
+
const classesWithOptional = collection_utils_1.setFilter(graph.allTypesUnordered(), t => t instanceof Type_1.ClassType && collection_utils_1.mapSome(t.getProperties(), p => p.isOptional));
|
|
386
377
|
const replacementGroups = Array.from(classesWithOptional).map(c => [c]);
|
|
387
378
|
if (classesWithOptional.size === 0) {
|
|
388
379
|
return graph;
|
|
389
380
|
}
|
|
390
381
|
return graph.rewrite("optional to nullable", stringTypeMapping, false, replacementGroups, debugPrintReconstitution, (setOfClass, builder, forwardingRef) => {
|
|
391
|
-
|
|
392
|
-
const c =
|
|
382
|
+
Support_1.assert(setOfClass.size === 1);
|
|
383
|
+
const c = Support_1.defined(collection_utils_1.iterableFirst(setOfClass));
|
|
393
384
|
return rewriteClass(c, builder, forwardingRef);
|
|
394
385
|
});
|
|
395
386
|
}
|
|
@@ -402,14 +393,14 @@ function removeIndirectionIntersections(graph, stringTypeMapping, debugPrintRema
|
|
|
402
393
|
const seen = new Set([t]);
|
|
403
394
|
let current = t;
|
|
404
395
|
while (current.members.size === 1) {
|
|
405
|
-
const member =
|
|
396
|
+
const member = Support_1.defined(collection_utils_1.iterableFirst(current.members));
|
|
406
397
|
if (!(member instanceof Type_1.IntersectionType)) {
|
|
407
398
|
map.push([t, member]);
|
|
408
399
|
break;
|
|
409
400
|
}
|
|
410
401
|
if (seen.has(member)) {
|
|
411
402
|
// FIXME: Technically, this is an any type.
|
|
412
|
-
return
|
|
403
|
+
return Support_1.panic("There's a cycle of intersection types");
|
|
413
404
|
}
|
|
414
405
|
seen.add(member);
|
|
415
406
|
current = member;
|
|
@@ -14,7 +14,7 @@ export declare function nullableFromUnion(t: UnionType): Type | null;
|
|
|
14
14
|
export declare function nonNullTypeCases(t: Type): ReadonlySet<Type>;
|
|
15
15
|
export declare function getNullAsOptional(cp: ClassProperty): [boolean, ReadonlySet<Type>];
|
|
16
16
|
export declare function isNamedType(t: Type): boolean;
|
|
17
|
-
export type SeparatedNamedTypes = {
|
|
17
|
+
export declare type SeparatedNamedTypes = {
|
|
18
18
|
objects: ReadonlySet<ObjectType>;
|
|
19
19
|
enums: ReadonlySet<EnumType>;
|
|
20
20
|
unions: ReadonlySet<UnionType>;
|
|
@@ -23,7 +23,7 @@ export declare function separateNamedTypes(types: Iterable<Type>): SeparatedName
|
|
|
23
23
|
export declare function directlyReachableTypes<T>(t: Type, setForType: (t: Type) => ReadonlySet<T> | null): ReadonlySet<T>;
|
|
24
24
|
export declare function directlyReachableSingleNamedType(type: Type): Type | undefined;
|
|
25
25
|
export declare function stringTypesForType(t: PrimitiveType): StringTypes;
|
|
26
|
-
export type StringTypeMatchers<U> = {
|
|
26
|
+
export declare type StringTypeMatchers<U> = {
|
|
27
27
|
dateType?: (dateType: PrimitiveType) => U;
|
|
28
28
|
timeType?: (timeType: PrimitiveType) => U;
|
|
29
29
|
dateTimeType?: (dateTimeType: PrimitiveType) => U;
|