ajsc 7.4.0 → 7.5.0
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/CHANGELOG.md +14 -0
- package/dist/converter/BaseConverter.d.ts +40 -5
- package/dist/converter/BaseConverter.js +47 -8
- package/dist/converter/BaseConverter.js.map +1 -1
- package/dist/converter/naming.js +6 -1
- package/dist/converter/naming.js.map +1 -1
- package/dist/typescript/TypescriptConverter.js +57 -20
- package/dist/typescript/TypescriptConverter.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to ajsc are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project follows [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [7.5.0] — 2026-06-30
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **TypeScript: generated type names no longer collide with global utility types ajsc emits.** A generated declaration whose name (from a depluralized property, a `title`, or an enum property) matched a TypeScript global generic — most commonly `Record` (from a `records` property or `title: "Record"`) shadowing the `Record<string, any>` emitted for `additionalProperties: true`, or `Array` shadowing array element references — produced output that `tsc` rejected with `TS2315: Type 'Record' is not generic`. Such names are now reserved across **all** declaration-name producers (extracted/referenced types, the root type, `enumStyle: "enum"` enum names, and discriminated-union variant names) and disambiguated to the `<Name>Type` form (e.g. `Record` → `RecordType`, `Array` → `ArrayType`), leaving the global references intact. The reserved set covers `Record`, `Array`, `Map`, `Set`, `Promise`, `Partial`, `Readonly`, `Pick`, `Omit`, `Exclude`, and `Required`. An explicit `rootTypeName` is honored verbatim (the caller owns that choice). The reservation is unconditional, so a schema that produced a type literally named e.g. `Record` (even without any `Record<…>` in its output) now emits `RecordType` instead.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **`RefTypeNamingConfig.reservedTypeNames`** (extension API, exported from `ajsc/converter`): a list of type names a language references as ambient globals, so generated declarations are never named one of them. Defaults to empty; the built-in TypeScript profile populates it. Accompanied by two `BaseConverterContext` helpers for downstream language authors — `isReservedTypeName(name)` and `claimDeclarationName(base)` (disambiguate-and-register in one step). Existing language targets and the default config are unaffected.
|
|
14
|
+
|
|
15
|
+
### Internal
|
|
16
|
+
|
|
17
|
+
- `getUniqueRefTypeName`, `findAvailableName`, `deriveEnumName`, and root-name selection all consult `reservedTypeNames` through the shared `isReservedTypeName` (memoized) so reserved names are treated as already-taken and disambiguated by the existing collision machinery. All non-path-derived declaration names now register through the single `claimDeclarationName` gate, so disambiguation and registration are atomic and cannot be bypassed. Kotlin and Swift leave the reserved set empty (Kotlin emits an explanatory KDoc note for `additionalProperties` rather than a `Map<String, …>`, so it has no analogous shadowing vector).
|
|
18
|
+
|
|
5
19
|
## [7.4.0] — 2026-06-29
|
|
6
20
|
|
|
7
21
|
### Changed
|
|
@@ -99,6 +99,15 @@ export interface RefTypeNamingConfig {
|
|
|
99
99
|
* @example ["criteria", "alumni", "corpus"]
|
|
100
100
|
*/
|
|
101
101
|
uncountableWords?: string[];
|
|
102
|
+
/**
|
|
103
|
+
* Type names the language references as ambient globals in emitted output
|
|
104
|
+
* (e.g. TS `Record<…>`, `Array<…>`). An extracted type must never be named
|
|
105
|
+
* one of these, or the local declaration would shadow the global the same
|
|
106
|
+
* output relies on, producing code that does not compile. Reserved names are
|
|
107
|
+
* treated as already-taken during naming, so the normal postfix escalation
|
|
108
|
+
* disambiguates them (e.g. `Record` → `RecordType`). Default: none.
|
|
109
|
+
*/
|
|
110
|
+
reservedTypeNames?: string[];
|
|
102
111
|
}
|
|
103
112
|
export type GenerateTypeUtils = {
|
|
104
113
|
getReferencedType(ir: IRNode): string | undefined;
|
|
@@ -134,6 +143,10 @@ export interface BaseConverterContext {
|
|
|
134
143
|
generateObjectType(ir: IRNode, utils: GenerateTypeUtils): string;
|
|
135
144
|
/** Returns a name not already in `usedDeclarationNames`, suffixing as needed. */
|
|
136
145
|
findAvailableName(base: string): string;
|
|
146
|
+
/** Disambiguates `base` and registers it in `usedDeclarationNames` atomically. */
|
|
147
|
+
claimDeclarationName(base: string): string;
|
|
148
|
+
/** True if `name` is a reserved global type name (see `reservedTypeNames`). */
|
|
149
|
+
isReservedTypeName(name: string): boolean;
|
|
137
150
|
/** Locates a const-string discriminator property across union options. */
|
|
138
151
|
findDiscriminatorProperty(options: IRNode[], sharedPropNames: string[]): string | null;
|
|
139
152
|
/** Computes shared and combined property names across union options. */
|
|
@@ -301,14 +314,36 @@ export declare abstract class BaseConverter implements Partial<ILanguageConverte
|
|
|
301
314
|
*/
|
|
302
315
|
stripDiscriminatorField(opt: IRNode, discriminator: string): IRNode;
|
|
303
316
|
/**
|
|
304
|
-
* Returns `base` if it is not already taken in `usedDeclarationNames
|
|
305
|
-
* otherwise appends an incrementing suffix
|
|
306
|
-
* free name is found. Subclasses use this for
|
|
307
|
-
* names where path-derived disambiguation is not
|
|
308
|
-
* names derived from a property name
|
|
317
|
+
* Returns `base` if it is not already taken in `usedDeclarationNames` and is
|
|
318
|
+
* not a reserved global type name, otherwise appends an incrementing suffix
|
|
319
|
+
* (`base2`, `base3`, …) until a free name is found. Subclasses use this for
|
|
320
|
+
* collision-free declaration names where path-derived disambiguation is not
|
|
321
|
+
* appropriate (e.g. enum names derived from a property name, discriminated-
|
|
322
|
+
* union variant names, the root type name). Honoring `reservedTypeNames` here
|
|
323
|
+
* keeps every declaration-name producer that routes through this helper from
|
|
324
|
+
* shadowing a global the same output references (e.g. `Record<…>`, `Array<…>`).
|
|
309
325
|
* @internal Public for `BaseConverterContext`; treat as protected for subclasses.
|
|
310
326
|
*/
|
|
311
327
|
findAvailableName(base: string): string;
|
|
328
|
+
/**
|
|
329
|
+
* Disambiguates `base` via `findAvailableName` AND records the result in
|
|
330
|
+
* `usedDeclarationNames`, returning it. This is the single gate for simple
|
|
331
|
+
* (non-path-derived) declaration names — root, enum, and discriminated-union
|
|
332
|
+
* variant names — so disambiguation and registration happen atomically and no
|
|
333
|
+
* caller can register a name that bypassed reserved-/used-name checks. (The
|
|
334
|
+
* path-derived analog, `getUniqueRefTypeName`, self-registers the same way.)
|
|
335
|
+
* @internal Public for `BaseConverterContext`; treat as protected for subclasses.
|
|
336
|
+
*/
|
|
337
|
+
claimDeclarationName(base: string): string;
|
|
338
|
+
/**
|
|
339
|
+
* True if `name` is a type the language references as an ambient global in
|
|
340
|
+
* emitted output (see `RefTypeNamingConfig.reservedTypeNames`). Declaration-
|
|
341
|
+
* name producers consult this so a generated declaration never shadows a
|
|
342
|
+
* global the same output relies on.
|
|
343
|
+
* @internal Public for `BaseConverterContext`; treat as protected for subclasses.
|
|
344
|
+
*/
|
|
345
|
+
isReservedTypeName(name: string): boolean;
|
|
346
|
+
private reservedTypeNamesSet?;
|
|
312
347
|
/** Delegates to `discriminatedUnions.ts`. */
|
|
313
348
|
protected applyDiscriminatedUnionEnhancements(ir: IRNode): void;
|
|
314
349
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computeExtractedTypeNames, getUniqueRefTypeName, } from "./naming.js";
|
|
1
|
+
import { computeExtractedTypeNames, getRefTypeNamingConfig, getUniqueRefTypeName, } from "./naming.js";
|
|
2
2
|
import { getReferencedType } from "./registry.js";
|
|
3
3
|
import { isDiscriminatedUnion, mergeCompatibleUnions, tryMergeObjectUnion, tryMergeProperty, } from "./mergeUnions.js";
|
|
4
4
|
import { applyDiscriminatedUnionEnhancements, collectUnionPropertyNames, enhanceDiscriminatedUnions, findDiscriminatorProperty, getConstStringValue, stripDiscriminatorField, } from "./discriminatedUnions.js";
|
|
@@ -102,21 +102,60 @@ export class BaseConverter {
|
|
|
102
102
|
return stripDiscriminatorField(this, opt, discriminator);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* Returns `base` if it is not already taken in `usedDeclarationNames
|
|
106
|
-
* otherwise appends an incrementing suffix
|
|
107
|
-
* free name is found. Subclasses use this for
|
|
108
|
-
* names where path-derived disambiguation is not
|
|
109
|
-
* names derived from a property name
|
|
105
|
+
* Returns `base` if it is not already taken in `usedDeclarationNames` and is
|
|
106
|
+
* not a reserved global type name, otherwise appends an incrementing suffix
|
|
107
|
+
* (`base2`, `base3`, …) until a free name is found. Subclasses use this for
|
|
108
|
+
* collision-free declaration names where path-derived disambiguation is not
|
|
109
|
+
* appropriate (e.g. enum names derived from a property name, discriminated-
|
|
110
|
+
* union variant names, the root type name). Honoring `reservedTypeNames` here
|
|
111
|
+
* keeps every declaration-name producer that routes through this helper from
|
|
112
|
+
* shadowing a global the same output references (e.g. `Record<…>`, `Array<…>`).
|
|
110
113
|
* @internal Public for `BaseConverterContext`; treat as protected for subclasses.
|
|
111
114
|
*/
|
|
112
115
|
findAvailableName(base) {
|
|
113
|
-
|
|
116
|
+
const taken = (name) => this.usedDeclarationNames.has(name) || this.isReservedTypeName(name);
|
|
117
|
+
if (!taken(base))
|
|
114
118
|
return base;
|
|
119
|
+
// When `base` itself is a reserved global, prefer the `<Name>Type` form for
|
|
120
|
+
// parity with extracted-type disambiguation (e.g. `Record` → `RecordType`)
|
|
121
|
+
// before falling back to numeric suffixes. Ordinary collisions (a name
|
|
122
|
+
// already declared) keep the established numeric scheme.
|
|
123
|
+
if (this.isReservedTypeName(base) && !taken(base + "Type"))
|
|
124
|
+
return base + "Type";
|
|
115
125
|
let i = 2;
|
|
116
|
-
while (
|
|
126
|
+
while (taken(base + i))
|
|
117
127
|
i++;
|
|
118
128
|
return base + i;
|
|
119
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Disambiguates `base` via `findAvailableName` AND records the result in
|
|
132
|
+
* `usedDeclarationNames`, returning it. This is the single gate for simple
|
|
133
|
+
* (non-path-derived) declaration names — root, enum, and discriminated-union
|
|
134
|
+
* variant names — so disambiguation and registration happen atomically and no
|
|
135
|
+
* caller can register a name that bypassed reserved-/used-name checks. (The
|
|
136
|
+
* path-derived analog, `getUniqueRefTypeName`, self-registers the same way.)
|
|
137
|
+
* @internal Public for `BaseConverterContext`; treat as protected for subclasses.
|
|
138
|
+
*/
|
|
139
|
+
claimDeclarationName(base) {
|
|
140
|
+
const name = this.findAvailableName(base);
|
|
141
|
+
this.usedDeclarationNames.add(name);
|
|
142
|
+
return name;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* True if `name` is a type the language references as an ambient global in
|
|
146
|
+
* emitted output (see `RefTypeNamingConfig.reservedTypeNames`). Declaration-
|
|
147
|
+
* name producers consult this so a generated declaration never shadows a
|
|
148
|
+
* global the same output relies on.
|
|
149
|
+
* @internal Public for `BaseConverterContext`; treat as protected for subclasses.
|
|
150
|
+
*/
|
|
151
|
+
isReservedTypeName(name) {
|
|
152
|
+
// Memoized: `getRefTypeNamingConfig` rebuilds the merged config (and its
|
|
153
|
+
// postfix array) on every call, and this predicate runs inside naming loops.
|
|
154
|
+
if (!this.reservedTypeNamesSet) {
|
|
155
|
+
this.reservedTypeNamesSet = new Set(getRefTypeNamingConfig(this).reservedTypeNames);
|
|
156
|
+
}
|
|
157
|
+
return this.reservedTypeNamesSet.has(name);
|
|
158
|
+
}
|
|
120
159
|
/** Delegates to `discriminatedUnions.ts`. */
|
|
121
160
|
applyDiscriminatedUnionEnhancements(ir) {
|
|
122
161
|
applyDiscriminatedUnionEnhancements(this, ir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseConverter.js","sourceRoot":"","sources":["../../src/converter/BaseConverter.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mCAAmC,EACnC,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,GACxB,MA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AAC;IAC7C,CAAC;IAGD,6CAA6C;IACnC,mCAAmC,CAAC,EAAU;QACtD,mCAAmC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACI,yBAAyB,CAAC,OAAiB;QAIhD,OAAO,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACI,yBAAyB,CAC9B,OAAiB,EACjB,eAAyB;QAEzB,OAAO,yBAAyB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACI,mBAAmB,CAAC,EAAsB;QAC/C,OAAO,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;CACF"}
|
package/dist/converter/naming.js
CHANGED
|
@@ -23,6 +23,7 @@ export function defaultRefTypeNamingConfig() {
|
|
|
23
23
|
stripLeadingAnySymbol: true,
|
|
24
24
|
depluralize: true,
|
|
25
25
|
arrayItemNaming: false,
|
|
26
|
+
reservedTypeNames: [],
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
@@ -101,7 +102,11 @@ export function getUniqueRefTypeName(c, signature, nodePath) {
|
|
|
101
102
|
}
|
|
102
103
|
continue;
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
+
// A reserved name (e.g. TS `Record`, `Array`) would shadow the global the
|
|
106
|
+
// same output relies on, so treat it as already-taken and let postfix
|
|
107
|
+
// escalation disambiguate (e.g. `Record` → `RecordType`).
|
|
108
|
+
const nameAlreadyUsed = c.usedDeclarationNames.has(proposedName) ||
|
|
109
|
+
c.isReservedTypeName(proposedName);
|
|
105
110
|
if (nameAlreadyUsed) {
|
|
106
111
|
pathsSegmentsToInclude++;
|
|
107
112
|
if (pathsSegmentsToInclude >= path.length) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming.js","sourceRoot":"","sources":["../../src/converter/naming.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,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,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -3,6 +3,29 @@ import { JSONSchemaConverter } from "../ir/JSONSchemaConverter.js";
|
|
|
3
3
|
import { toPascalCase } from "../utils/to-pascal-case.js";
|
|
4
4
|
import { PathUtils } from "../utils/path-utils.js";
|
|
5
5
|
import { walkIR, } from "../converter/BaseConverter.js";
|
|
6
|
+
/**
|
|
7
|
+
* Global/utility type names that emitted TypeScript references as ambient
|
|
8
|
+
* generics (or that consumers commonly rely on). An extracted type must never
|
|
9
|
+
* be named one of these, or the local `export type X = …` declaration would
|
|
10
|
+
* shadow the global the same output depends on — e.g. a depluralized `Record`
|
|
11
|
+
* shadowing the `Record<string, any>` ajsc emits for `additionalProperties`,
|
|
12
|
+
* which `tsc` rejects with TS2315. ajsc itself emits `Record<…>` and `Array<…>`;
|
|
13
|
+
* the remainder are reserved defensively against future emit paths and consumer
|
|
14
|
+
* usage. Reserved names are disambiguated via postfix (e.g. `Record` → `RecordType`).
|
|
15
|
+
*/
|
|
16
|
+
const TS_RESERVED_TYPE_NAMES = [
|
|
17
|
+
"Record",
|
|
18
|
+
"Array",
|
|
19
|
+
"Map",
|
|
20
|
+
"Set",
|
|
21
|
+
"Promise",
|
|
22
|
+
"Partial",
|
|
23
|
+
"Readonly",
|
|
24
|
+
"Pick",
|
|
25
|
+
"Omit",
|
|
26
|
+
"Exclude",
|
|
27
|
+
"Required",
|
|
28
|
+
];
|
|
6
29
|
/**
|
|
7
30
|
* A TypeScript language converter plugin.
|
|
8
31
|
*/
|
|
@@ -31,9 +54,7 @@ export class TypescriptConverter extends TypescriptBaseConverter {
|
|
|
31
54
|
resolveRefTypeName: (ir, _sig, defaultResolver) => {
|
|
32
55
|
const variantName = this.variantNames.get(ir);
|
|
33
56
|
if (variantName) {
|
|
34
|
-
|
|
35
|
-
this.usedDeclarationNames.add(name);
|
|
36
|
-
return name;
|
|
57
|
+
return this.claimDeclarationName(variantName);
|
|
37
58
|
}
|
|
38
59
|
return defaultResolver();
|
|
39
60
|
},
|
|
@@ -45,22 +66,31 @@ export class TypescriptConverter extends TypescriptBaseConverter {
|
|
|
45
66
|
const irNode = this.mergeCompatibleUnions(this.schemaConverter.irNode);
|
|
46
67
|
this.enhanceDiscriminatedUnions(irNode);
|
|
47
68
|
if (this.baseOpts?.rootTypeName) {
|
|
69
|
+
// Explicit caller-supplied name: a hard contract, used verbatim (the
|
|
70
|
+
// caller owns the risk of shadowing a global it also references).
|
|
48
71
|
irNode.name = this.baseOpts.rootTypeName;
|
|
72
|
+
this.usedDeclarationNames.add(irNode.name);
|
|
49
73
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
irNode.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
else {
|
|
75
|
+
if (!irNode.name) {
|
|
76
|
+
// Enum/literal roots have no `name` from the IR (only objects/arrays do),
|
|
77
|
+
// so fall back to `title` for those cases. Other typed roots already get
|
|
78
|
+
// a `name` upstream and continue to use "Root" when none is set.
|
|
79
|
+
if (irNode.type === "enum" || irNode.type === "literal") {
|
|
80
|
+
irNode.name = irNode.title || "Root";
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
irNode.name = "Root";
|
|
84
|
+
}
|
|
59
85
|
}
|
|
86
|
+
// The derived name (from IR `name`/`title`) may itself be a reserved
|
|
87
|
+
// global type (e.g. a root titled "Record" or "Array"); claim it so the
|
|
88
|
+
// root declaration cannot shadow a global the output references.
|
|
89
|
+
irNode.name = this.claimDeclarationName(irNode.name);
|
|
60
90
|
}
|
|
61
|
-
//
|
|
91
|
+
// Root name is now registered in usedDeclarationNames so enums/ref types
|
|
92
|
+
// don't collide with it.
|
|
62
93
|
this.rootName = irNode.name;
|
|
63
|
-
this.usedDeclarationNames.add(this.rootName);
|
|
64
94
|
this.referencedNamedTypes = this.computeReferencedNamedTypes(irNode);
|
|
65
95
|
// Pre-register enum names before type generation so that enum names
|
|
66
96
|
// (derived from meaningful property names) take precedence over
|
|
@@ -107,7 +137,9 @@ export class TypescriptConverter extends TypescriptBaseConverter {
|
|
|
107
137
|
this.extractedTypeNames = this.computeExtractedTypeNames().filter((n) => n !== this.rootTypeName);
|
|
108
138
|
}
|
|
109
139
|
computeRefTypeNamingConfigOverrides() {
|
|
110
|
-
const out = {
|
|
140
|
+
const out = {
|
|
141
|
+
reservedTypeNames: TS_RESERVED_TYPE_NAMES,
|
|
142
|
+
};
|
|
111
143
|
if (this.opts?.arrayItemNaming !== undefined)
|
|
112
144
|
out.arrayItemNaming = this.opts.arrayItemNaming;
|
|
113
145
|
if (this.opts?.depluralize !== undefined)
|
|
@@ -193,7 +225,6 @@ export class TypescriptConverter extends TypescriptBaseConverter {
|
|
|
193
225
|
return existing.name;
|
|
194
226
|
}
|
|
195
227
|
const enumName = this.deriveEnumName(path);
|
|
196
|
-
this.usedDeclarationNames.add(enumName);
|
|
197
228
|
// Build members with collision resolution
|
|
198
229
|
const usedMemberNames = new Set();
|
|
199
230
|
const members = values.map((value) => {
|
|
@@ -223,21 +254,27 @@ export class TypescriptConverter extends TypescriptBaseConverter {
|
|
|
223
254
|
*/
|
|
224
255
|
deriveEnumName(path) {
|
|
225
256
|
const segments = PathUtils.parsePath(path).filter((x) => !/^\d+$/.test(x));
|
|
257
|
+
// Each branch ends in `claimDeclarationName`, which disambiguates against
|
|
258
|
+
// reserved/used names and registers the result — so this method, like
|
|
259
|
+
// `getUniqueRefTypeName`, self-registers and never hands back an
|
|
260
|
+
// unreserved name. The loop's own checks only drive parent-segment
|
|
261
|
+
// escalation (which `claimDeclarationName`'s numeric suffix can't do).
|
|
226
262
|
if (segments.length === 0) {
|
|
227
|
-
return this.
|
|
263
|
+
return this.claimDeclarationName("Value");
|
|
228
264
|
}
|
|
229
265
|
// Try progressively more parent path segments
|
|
230
266
|
for (let count = 1; count <= segments.length; count++) {
|
|
231
267
|
const proposed = segments.slice(-count).map(toPascalCase).join("");
|
|
232
268
|
if (proposed &&
|
|
233
269
|
this.isValidIdentifier(proposed) &&
|
|
234
|
-
!this.usedDeclarationNames.has(proposed)
|
|
235
|
-
|
|
270
|
+
!this.usedDeclarationNames.has(proposed) &&
|
|
271
|
+
!this.isReservedTypeName(proposed)) {
|
|
272
|
+
return this.claimDeclarationName(proposed);
|
|
236
273
|
}
|
|
237
274
|
}
|
|
238
275
|
// All segment combinations exhausted or collided — use counter fallback
|
|
239
276
|
const fullName = segments.map(toPascalCase).join("") || "Value";
|
|
240
|
-
return this.
|
|
277
|
+
return this.claimDeclarationName(this.isValidIdentifier(fullName) ? fullName : "Value");
|
|
241
278
|
}
|
|
242
279
|
/**
|
|
243
280
|
* Converts a string value to a valid PascalCase enum member name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypescriptConverter.js","sourceRoot":"","sources":["../../src/typescript/TypescriptConverter.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAGL,MAAM,GACP,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"TypescriptConverter.js","sourceRoot":"","sources":["../../src/typescript/TypescriptConverter.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAGL,MAAM,GACP,MAAM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