@twin.org/tools-core 0.0.3-next.2 → 0.0.3-next.21
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/README.md +2 -2
- package/dist/es/index.js +20 -11
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/ITypeScriptToSchemaContext.js +2 -0
- package/dist/es/models/ITypeScriptToSchemaContext.js.map +1 -0
- package/dist/es/models/ITypeScriptToSchemaDiagnostics.js +4 -0
- package/dist/es/models/ITypeScriptToSchemaDiagnostics.js.map +1 -0
- package/dist/es/models/ITypeScriptToSchemaOptions.js +4 -0
- package/dist/es/models/ITypeScriptToSchemaOptions.js.map +1 -0
- package/dist/es/utils/constants.js +43 -0
- package/dist/es/utils/constants.js.map +1 -0
- package/dist/es/utils/diagnosticReporter.js +32 -0
- package/dist/es/utils/diagnosticReporter.js.map +1 -0
- package/dist/es/utils/disallowedTypeGuard.js +151 -0
- package/dist/es/utils/disallowedTypeGuard.js.map +1 -0
- package/dist/es/utils/enum.js +152 -0
- package/dist/es/utils/enum.js.map +1 -0
- package/dist/es/utils/fileUtils.js +130 -0
- package/dist/es/utils/fileUtils.js.map +1 -0
- package/dist/es/utils/importTypeQuerySchemaResolver.js +328 -0
- package/dist/es/utils/importTypeQuerySchemaResolver.js.map +1 -0
- package/dist/es/utils/indexSignaturePatternResolver.js +94 -0
- package/dist/es/utils/indexSignaturePatternResolver.js.map +1 -0
- package/dist/es/utils/intersectionSchemaMerger.js +85 -0
- package/dist/es/utils/intersectionSchemaMerger.js.map +1 -0
- package/dist/es/utils/jsDoc.js +120 -0
- package/dist/es/utils/jsDoc.js.map +1 -0
- package/dist/es/utils/jsonSchemaBuilder.js +3373 -0
- package/dist/es/utils/jsonSchemaBuilder.js.map +1 -0
- package/dist/es/utils/mappedTypeSchemaResolver.js +231 -0
- package/dist/es/utils/mappedTypeSchemaResolver.js.map +1 -0
- package/dist/es/utils/objectTransformer.js +162 -0
- package/dist/es/utils/objectTransformer.js.map +1 -0
- package/dist/es/utils/regEx.js +128 -0
- package/dist/es/utils/regEx.js.map +1 -0
- package/dist/es/utils/resolver.js +164 -0
- package/dist/es/utils/resolver.js.map +1 -0
- package/dist/es/utils/templateLiteralPatternBuilder.js +94 -0
- package/dist/es/utils/templateLiteralPatternBuilder.js.map +1 -0
- package/dist/es/utils/typeScriptToSchema.js +112 -0
- package/dist/es/utils/typeScriptToSchema.js.map +1 -0
- package/dist/es/utils/utilityTypeSchemaMapper.js +412 -0
- package/dist/es/utils/utilityTypeSchemaMapper.js.map +1 -0
- package/dist/types/index.d.ts +20 -11
- package/dist/types/models/ITypeScriptToSchemaContext.d.ts +64 -0
- package/dist/types/models/ITypeScriptToSchemaDiagnostics.d.ts +31 -0
- package/dist/types/models/ITypeScriptToSchemaOptions.d.ts +22 -0
- package/dist/types/utils/constants.d.ts +13 -0
- package/dist/types/utils/diagnosticReporter.d.ts +17 -0
- package/dist/types/utils/disallowedTypeGuard.d.ts +16 -0
- package/dist/types/utils/enum.d.ts +42 -0
- package/dist/types/utils/fileUtils.d.ts +66 -0
- package/dist/types/utils/importTypeQuerySchemaResolver.d.ts +52 -0
- package/dist/types/utils/indexSignaturePatternResolver.d.ts +21 -0
- package/dist/types/utils/intersectionSchemaMerger.d.ts +16 -0
- package/dist/types/utils/jsDoc.d.ts +46 -0
- package/dist/types/utils/jsonSchemaBuilder.d.ts +747 -0
- package/dist/types/utils/mappedTypeSchemaResolver.d.ts +46 -0
- package/dist/types/utils/objectTransformer.d.ts +33 -0
- package/dist/types/utils/regEx.d.ts +24 -0
- package/dist/types/utils/resolver.d.ts +16 -0
- package/dist/types/utils/templateLiteralPatternBuilder.d.ts +12 -0
- package/dist/types/utils/typeScriptToSchema.d.ts +31 -0
- package/dist/types/utils/utilityTypeSchemaMapper.d.ts +92 -0
- package/docs/changelog.md +176 -1
- package/docs/examples.md +87 -1
- package/docs/reference/classes/Constants.md +29 -0
- package/docs/reference/classes/DiagnosticReporter.md +49 -0
- package/docs/reference/classes/DisallowedTypeGuard.md +35 -0
- package/docs/reference/classes/Enum.md +93 -0
- package/docs/reference/classes/FileUtils.md +237 -0
- package/docs/reference/classes/ImportTypeQuerySchemaResolver.md +87 -0
- package/docs/reference/classes/IndexSignaturePatternResolver.md +69 -0
- package/docs/reference/classes/IntersectionSchemaMerger.md +48 -0
- package/docs/reference/classes/JsDoc.md +141 -0
- package/docs/reference/classes/JsonSchemaBuilder.md +2870 -0
- package/docs/reference/classes/MappedTypeSchemaResolver.md +211 -0
- package/docs/reference/classes/ObjectTransformer.md +119 -0
- package/docs/reference/classes/RegEx.md +99 -0
- package/docs/reference/classes/Resolver.md +41 -0
- package/docs/reference/classes/TemplateLiteralPatternBuilder.md +35 -0
- package/docs/reference/classes/TypeScriptToSchema.md +91 -0
- package/docs/reference/classes/UtilityTypeSchemaMapper.md +341 -0
- package/docs/reference/index.md +20 -14
- package/docs/reference/interfaces/ITypeScriptToSchemaContext.md +113 -0
- package/docs/reference/interfaces/ITypeScriptToSchemaDiagnostics.md +55 -0
- package/docs/reference/interfaces/ITypeScriptToSchemaOptions.md +44 -0
- package/locales/en.json +32 -1
- package/package.json +4 -3
- package/dist/es/models/IJsonSchema.js +0 -2
- package/dist/es/models/IJsonSchema.js.map +0 -1
- package/dist/es/models/IOpenApi.js +0 -2
- package/dist/es/models/IOpenApi.js.map +0 -1
- package/dist/es/models/IOpenApiExample.js +0 -4
- package/dist/es/models/IOpenApiExample.js.map +0 -1
- package/dist/es/models/IOpenApiHeader.js +0 -4
- package/dist/es/models/IOpenApiHeader.js.map +0 -1
- package/dist/es/models/IOpenApiPathMethod.js +0 -2
- package/dist/es/models/IOpenApiPathMethod.js.map +0 -1
- package/dist/es/models/IOpenApiResponse.js +0 -2
- package/dist/es/models/IOpenApiResponse.js.map +0 -1
- package/dist/es/models/IOpenApiSecurityScheme.js +0 -4
- package/dist/es/models/IOpenApiSecurityScheme.js.map +0 -1
- package/dist/es/models/IPackageJson.js +0 -4
- package/dist/es/models/IPackageJson.js.map +0 -1
- package/dist/es/models/jsonTypeName.js +0 -2
- package/dist/es/models/jsonTypeName.js.map +0 -1
- package/dist/es/utils/jsonSchemaHelper.js +0 -258
- package/dist/es/utils/jsonSchemaHelper.js.map +0 -1
- package/dist/es/utils/openApiHelper.js +0 -12
- package/dist/es/utils/openApiHelper.js.map +0 -1
- package/dist/types/models/IJsonSchema.d.ts +0 -5
- package/dist/types/models/IOpenApi.d.ts +0 -54
- package/dist/types/models/IOpenApiExample.d.ts +0 -13
- package/dist/types/models/IOpenApiHeader.d.ts +0 -19
- package/dist/types/models/IOpenApiPathMethod.d.ts +0 -65
- package/dist/types/models/IOpenApiResponse.d.ts +0 -32
- package/dist/types/models/IOpenApiSecurityScheme.d.ts +0 -25
- package/dist/types/models/IPackageJson.d.ts +0 -15
- package/dist/types/models/jsonTypeName.d.ts +0 -5
- package/dist/types/utils/jsonSchemaHelper.d.ts +0 -78
- package/dist/types/utils/openApiHelper.d.ts +0 -9
- package/docs/reference/classes/JsonSchemaHelper.md +0 -233
- package/docs/reference/classes/OpenApiHelper.md +0 -21
- package/docs/reference/interfaces/IOpenApi.md +0 -103
- package/docs/reference/interfaces/IOpenApiExample.md +0 -19
- package/docs/reference/interfaces/IOpenApiHeader.md +0 -31
- package/docs/reference/interfaces/IOpenApiPathMethod.md +0 -119
- package/docs/reference/interfaces/IOpenApiResponse.md +0 -35
- package/docs/reference/interfaces/IOpenApiSecurityScheme.md +0 -43
- package/docs/reference/interfaces/IPackageJson.md +0 -23
- package/docs/reference/type-aliases/IJsonSchema.md +0 -5
- package/docs/reference/type-aliases/JsonTypeName.md +0 -5
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { IJsonSchema } from "@twin.org/tools-models";
|
|
2
|
+
import * as ts from "typescript";
|
|
3
|
+
import type { ITypeScriptToSchemaContext } from "../models/ITypeScriptToSchemaContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Static mapped-type schema transformation helpers.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MappedTypeSchemaResolver {
|
|
8
|
+
/**
|
|
9
|
+
* Resolve mapped type output keys, including remapped key names via `as`.
|
|
10
|
+
*/
|
|
11
|
+
static resolveMappedTypePropertyEntries(context: ITypeScriptToSchemaContext, typeNode: ts.MappedTypeNode, mappedKeys: string[], mappedTypeParameterName: string): {
|
|
12
|
+
sourceKey: string;
|
|
13
|
+
mappedKey: string;
|
|
14
|
+
}[] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a remapped mapped-type key expression for a concrete source key.
|
|
17
|
+
*/
|
|
18
|
+
static resolveMappedTypeRemappedKey(context: ITypeScriptToSchemaContext, nameTypeNode: ts.TypeNode, sourceKey: string, mappedTypeParameterName: string): string | null | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Evaluate whether a concrete mapped key satisfies an `extends` condition.
|
|
21
|
+
*/
|
|
22
|
+
static evaluateMappedKeyExtendsCondition(context: ITypeScriptToSchemaContext, sourceKey: string, extendsTypeNode: ts.TypeNode): boolean | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Build a conservative fallback schema for mapped types whose key remapping cannot be resolved.
|
|
25
|
+
*/
|
|
26
|
+
static buildMappedTypeFallbackSchema(context: ITypeScriptToSchemaContext, typeNode: ts.MappedTypeNode, mappedKeys: string[], mappedTypeParameterName: string, sourceObjectSchema?: IJsonSchema): IJsonSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Build fallback additionalProperties for unresolved mapped key remapping.
|
|
29
|
+
*/
|
|
30
|
+
static buildMappedTypeFallbackAdditionalProperties(context: ITypeScriptToSchemaContext, typeNode: ts.MappedTypeNode, mappedKeys: string[], mappedTypeParameterName: string, sourceObjectSchema?: IJsonSchema): IJsonSchema | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Merge mapped property schemas when multiple source keys remap to the same output key.
|
|
33
|
+
*/
|
|
34
|
+
static mergeMappedTypePropertySchemas(existingSchema: IJsonSchema, nextSchema: IJsonSchema): IJsonSchema;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve required remapped keys from the source object's required key set.
|
|
37
|
+
*/
|
|
38
|
+
static resolveMappedTypeSourceRequiredPropertyKeys(mappedEntries: {
|
|
39
|
+
sourceKey: string;
|
|
40
|
+
mappedKey: string;
|
|
41
|
+
}[], sourceObjectSchema: IJsonSchema): string[] | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Apply TypeScript intrinsic string remapping helpers to a key.
|
|
44
|
+
*/
|
|
45
|
+
private static applyIntrinsicMappedTypeKeyRemap;
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IJsonSchema } from "@twin.org/tools-models";
|
|
2
|
+
/**
|
|
3
|
+
* Applies common object-schema transformations used by the builder.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ObjectTransformer {
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a property schema from an object schema by property key.
|
|
8
|
+
* @param baseSchema The source object schema.
|
|
9
|
+
* @param propertyKey The property key to resolve.
|
|
10
|
+
* @returns The resolved property schema.
|
|
11
|
+
*/
|
|
12
|
+
static resolvePropertySchemaFromObjectSchema(baseSchema: IJsonSchema, propertyKey: string): IJsonSchema | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Remove keys from an object schema.
|
|
15
|
+
* @param baseSchema The source object schema.
|
|
16
|
+
* @param omittedKeys The keys to remove.
|
|
17
|
+
* @returns The transformed object schema.
|
|
18
|
+
*/
|
|
19
|
+
static omitKeysFromObjectSchema(baseSchema: IJsonSchema, omittedKeys: string[]): IJsonSchema;
|
|
20
|
+
/**
|
|
21
|
+
* Keep only keys from an object schema.
|
|
22
|
+
* @param baseSchema The source object schema.
|
|
23
|
+
* @param pickedKeys The keys to keep.
|
|
24
|
+
* @returns The transformed object schema.
|
|
25
|
+
*/
|
|
26
|
+
static pickKeysFromObjectSchema(baseSchema: IJsonSchema, pickedKeys: string[]): IJsonSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Normalize schema description whitespace while preserving intentional line breaks.
|
|
29
|
+
* @param schema The schema to normalize.
|
|
30
|
+
* @returns The normalized schema.
|
|
31
|
+
*/
|
|
32
|
+
static normalizeSchemaDescriptions(schema: IJsonSchema): IJsonSchema;
|
|
33
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility methods for pattern matching and regex construction.
|
|
3
|
+
*/
|
|
4
|
+
export declare class RegEx {
|
|
5
|
+
/**
|
|
6
|
+
* Determine whether a reference mapping pattern matches an external reference.
|
|
7
|
+
* @param pattern The mapping pattern.
|
|
8
|
+
* @param packageName The external package name.
|
|
9
|
+
* @param typeName The imported type name.
|
|
10
|
+
* @param schemaTitle The derived schema title.
|
|
11
|
+
* @returns True if matched.
|
|
12
|
+
*/
|
|
13
|
+
static isReferencePatternMatch(pattern: string, packageName: string, typeName: string, schemaTitle: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Apply a reference mapping replacement to the first matching candidate.
|
|
16
|
+
* @param pattern The mapping pattern.
|
|
17
|
+
* @param replacement The replacement template.
|
|
18
|
+
* @param packageName The external package name.
|
|
19
|
+
* @param typeName The imported type name.
|
|
20
|
+
* @param schemaTitle The derived schema title.
|
|
21
|
+
* @returns The replaced value if a candidate matches.
|
|
22
|
+
*/
|
|
23
|
+
static applyReferencePatternReplacement(pattern: string, replacement: string, packageName: string, typeName: string, schemaTitle: string): string | undefined;
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as ts from "typescript";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve TypeScript type declarations from package names.
|
|
4
|
+
*/
|
|
5
|
+
export declare class Resolver {
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a type declaration AST from a package and type name.
|
|
8
|
+
* @param packageName The package to inspect.
|
|
9
|
+
* @param typeName The type to resolve.
|
|
10
|
+
* @returns The resolved declaration AST.
|
|
11
|
+
*/
|
|
12
|
+
static resolveTypeDeclarationAst(packageName: string, typeName: string): {
|
|
13
|
+
sourceFile: ts.SourceFile;
|
|
14
|
+
declaration: ts.InterfaceDeclaration | ts.TypeAliasDeclaration;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as ts from "typescript";
|
|
2
|
+
/**
|
|
3
|
+
* Builds regex patterns for TypeScript template literal types.
|
|
4
|
+
*/
|
|
5
|
+
export declare class TemplateLiteralPatternBuilder {
|
|
6
|
+
/**
|
|
7
|
+
* Build a regular-expression pattern for a template literal type.
|
|
8
|
+
* @param typeNode The template literal type node.
|
|
9
|
+
* @returns The regex pattern, or undefined if a safe pattern cannot be derived.
|
|
10
|
+
*/
|
|
11
|
+
static buildTemplateLiteralPattern(typeNode: ts.TemplateLiteralTypeNode): string | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IJsonSchema } from "@twin.org/tools-models";
|
|
2
|
+
import type { ITypeScriptToSchemaOptions } from "../models/ITypeScriptToSchemaOptions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Class for converting TypeScript types to JSON Schema.
|
|
5
|
+
*/
|
|
6
|
+
export declare class TypeScriptToSchema {
|
|
7
|
+
/**
|
|
8
|
+
* Generates a JSON schema from a TypeScript source file or type name.
|
|
9
|
+
* @param namespace The schema namespace.
|
|
10
|
+
* @param packageName The package name.
|
|
11
|
+
* @param schemas The package schema map.
|
|
12
|
+
* @param sourceFileOrTypeName The source file to process or type name to resolve.
|
|
13
|
+
* @param options Additional generation options.
|
|
14
|
+
* @returns The generated JSON schemas indexed by title.
|
|
15
|
+
*/
|
|
16
|
+
generateSchema(namespace: string, packageName: string, schemas: {
|
|
17
|
+
[id: string]: {
|
|
18
|
+
[id: string]: IJsonSchema;
|
|
19
|
+
};
|
|
20
|
+
}, sourceFileOrTypeName: string, options?: ITypeScriptToSchemaOptions): Promise<{
|
|
21
|
+
[id: string]: IJsonSchema;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Determine if a diagnostic originates from a specific package.
|
|
25
|
+
* @param path The schema or source path associated with the diagnostic.
|
|
26
|
+
* @param fileName The source filename associated with the diagnostic.
|
|
27
|
+
* @param packageName The package name to check, e.g. jose.
|
|
28
|
+
* @returns True if the diagnostic originated from the package.
|
|
29
|
+
*/
|
|
30
|
+
isDiagnosticFromPackage(path: string, fileName: string | undefined, packageName: string): boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { IJsonSchema } from "@twin.org/tools-models";
|
|
2
|
+
import * as ts from "typescript";
|
|
3
|
+
import type { ITypeScriptToSchemaContext } from "../models/ITypeScriptToSchemaContext.js";
|
|
4
|
+
/**
|
|
5
|
+
* Static utility-type schema mapping helpers.
|
|
6
|
+
*/
|
|
7
|
+
export declare class UtilityTypeSchemaMapper {
|
|
8
|
+
/**
|
|
9
|
+
* Map Partial<T> to an object schema with no required properties.
|
|
10
|
+
* @param context The generation context.
|
|
11
|
+
* @param typeNode The Partial type reference.
|
|
12
|
+
* @param resolveUtilityBaseObjectSchema Callback to resolve base object schemas.
|
|
13
|
+
* @returns The mapped schema.
|
|
14
|
+
*/
|
|
15
|
+
static mapPartialUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, resolveUtilityBaseObjectSchema: (context: ITypeScriptToSchemaContext, baseTypeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Map Required<T> to an object schema with all properties required.
|
|
18
|
+
* @param context The generation context.
|
|
19
|
+
* @param typeNode The Required type reference.
|
|
20
|
+
* @param resolveUtilityBaseObjectSchema Callback to resolve base object schemas.
|
|
21
|
+
* @returns The mapped schema.
|
|
22
|
+
*/
|
|
23
|
+
static mapRequiredUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, resolveUtilityBaseObjectSchema: (context: ITypeScriptToSchemaContext, baseTypeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Map Pick<T, K> to an object schema with selected keys preserved.
|
|
26
|
+
*/
|
|
27
|
+
static mapPickUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, resolveUtilityBaseObjectSchema: (context: ITypeScriptToSchemaContext, baseTypeNode: ts.TypeNode) => IJsonSchema | undefined, extractUtilityTypeKeys: (context: ITypeScriptToSchemaContext, keysNode: ts.TypeNode | undefined) => string[]): IJsonSchema | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Map Omit<T, K> to an object schema with selected keys removed.
|
|
30
|
+
*/
|
|
31
|
+
static mapOmitUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, resolveUtilityBaseObjectSchema: (context: ITypeScriptToSchemaContext, baseTypeNode: ts.TypeNode) => IJsonSchema | undefined, extractUtilityTypeKeys: (context: ITypeScriptToSchemaContext, keysNode: ts.TypeNode | undefined) => string[]): IJsonSchema | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Map Exclude<T, U> to a schema that removes U members from T.
|
|
34
|
+
*/
|
|
35
|
+
static mapExcludeUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, mapTypeNodeToSchema: (context: ITypeScriptToSchemaContext, typeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Map Extract<T, U> to a schema that keeps U members from T.
|
|
38
|
+
*/
|
|
39
|
+
static mapExtractUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, mapTypeNodeToSchema: (context: ITypeScriptToSchemaContext, typeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Map NonNullable<T> by removing null and undefined branches from T.
|
|
42
|
+
*/
|
|
43
|
+
static mapNonNullableUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, mapTypeNodeToSchema: (context: ITypeScriptToSchemaContext, typeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Map Record<K, V> to an object schema with key constraints where possible.
|
|
46
|
+
*/
|
|
47
|
+
static mapRecordUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, mapTypeNodeToSchema: (context: ITypeScriptToSchemaContext, typeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Map JsonLdObject utility types using key-removal and optional key-addition rules.
|
|
50
|
+
*/
|
|
51
|
+
static mapJsonLdObjectUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, options: {
|
|
52
|
+
keysToRemove: string[];
|
|
53
|
+
keyToAdd?: "id" | "@id" | "type" | "@type" | "@context";
|
|
54
|
+
isAddedKeyRequired?: boolean;
|
|
55
|
+
}, resolveUtilityBaseObjectSchema: (context: ITypeScriptToSchemaContext, baseTypeNode: ts.TypeNode) => IJsonSchema | undefined, mapTypeNodeToSchema: (context: ITypeScriptToSchemaContext, typeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Map ObjectOrArray<T> to a schema accepting T or T[].
|
|
58
|
+
*/
|
|
59
|
+
static mapObjectOrArrayUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, mapTypeNodeToSchema: (context: ITypeScriptToSchemaContext, typeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Map SingleOccurrenceArray<T, U> to a non-empty array containing exactly one U.
|
|
62
|
+
*/
|
|
63
|
+
static mapSingleOccurrenceArrayUtilityType(context: ITypeScriptToSchemaContext, typeNode: ts.TypeReferenceNode, mapTypeNodeToSchema: (context: ITypeScriptToSchemaContext, typeNode: ts.TypeNode) => IJsonSchema | undefined): IJsonSchema | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Determine whether a type node represents null or undefined.
|
|
66
|
+
*/
|
|
67
|
+
private static isNullOrUndefinedTypeNode;
|
|
68
|
+
/**
|
|
69
|
+
* Extract literal keys from a Record key type argument.
|
|
70
|
+
*/
|
|
71
|
+
private static extractRecordLiteralKeys;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve a default schema for JsonLdObject utility key additions when the type argument is omitted.
|
|
74
|
+
*/
|
|
75
|
+
private static mapJsonLdObjectDefaultSchemaByKey;
|
|
76
|
+
/**
|
|
77
|
+
* Resolve default id schema for JsonLdObjectWithId when Id type argument is omitted.
|
|
78
|
+
*/
|
|
79
|
+
private static mapJsonLdObjectWithIdDefaultIdSchema;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve default type schema for JsonLdObjectWithType when Type argument is omitted.
|
|
82
|
+
*/
|
|
83
|
+
private static mapJsonLdObjectWithTypeDefaultTypeSchema;
|
|
84
|
+
/**
|
|
85
|
+
* Resolve default context schema for JsonLdObjectWithContext when Context argument is omitted.
|
|
86
|
+
*/
|
|
87
|
+
private static mapJsonLdObjectWithContextDefaultContextSchema;
|
|
88
|
+
/**
|
|
89
|
+
* Resolve default schema from either of two source keys, with fallback when both are absent.
|
|
90
|
+
*/
|
|
91
|
+
private static mapJsonLdObjectDefaultEitherSchema;
|
|
92
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,180 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.21](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.20...tools-core-v0.0.3-next.21) (2026-03-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add jsdoc tag validation ([971b8d3](https://github.com/twinfoundation/tools/commit/971b8d3817d40467bfd7549c99af602f0c590299))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/tools-models bumped from 0.0.3-next.20 to 0.0.3-next.21
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.20](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.19...tools-core-v0.0.3-next.20) (2026-03-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **tools-core:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/tools-models bumped from 0.0.3-next.19 to 0.0.3-next.20
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.19](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.18...tools-core-v0.0.3-next.19) (2026-03-19)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **tools-core:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/tools-models bumped from 0.0.3-next.18 to 0.0.3-next.19
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.18](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.17...tools-core-v0.0.3-next.18) (2026-03-19)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* add jsdoc default value to schema ([7886a84](https://github.com/twinfoundation/tools/commit/7886a84961e692d2054f223e2e99205a654b76a6))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/tools-models bumped from 0.0.3-next.17 to 0.0.3-next.18
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.17](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.16...tools-core-v0.0.3-next.17) (2026-03-19)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* improve discriminated unions ([9c36ea7](https://github.com/twinfoundation/tools/commit/9c36ea7283230089ff19085ddc4b4c30a4e3f8a2))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/tools-models bumped from 0.0.3-next.16 to 0.0.3-next.17
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.16](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.15...tools-core-v0.0.3-next.16) (2026-03-19)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* ts to schema ([#86](https://github.com/twinfoundation/tools/issues/86)) ([ffebda5](https://github.com/twinfoundation/tools/commit/ffebda5f14ab5ec734bf37c9fb70a7ec3d4012c3))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/tools-models bumped from 0.0.3-next.15 to 0.0.3-next.16
|
|
86
|
+
|
|
87
|
+
## [0.0.3-next.15](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.14...tools-core-v0.0.3-next.15) (2026-03-10)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Features
|
|
91
|
+
|
|
92
|
+
* use jsdoc tags for json-ld markup ([1ea872e](https://github.com/twinfoundation/tools/commit/1ea872e07a1cc0e94178158a57383d64008e02e3))
|
|
93
|
+
|
|
94
|
+
## [0.0.3-next.14](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.13...tools-core-v0.0.3-next.14) (2026-03-06)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Bug Fixes
|
|
98
|
+
|
|
99
|
+
* improve schema output ([9e53cbe](https://github.com/twinfoundation/tools/commit/9e53cbe26e6272323d72c65e277b7d24521fdbba))
|
|
100
|
+
|
|
101
|
+
## [0.0.3-next.13](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.12...tools-core-v0.0.3-next.13) (2026-03-05)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Bug Fixes
|
|
105
|
+
|
|
106
|
+
* work for schema generator spread defect ([1a705ff](https://github.com/twinfoundation/tools/commit/1a705ffc74b353f652e74ea43454164a2f6740bf))
|
|
107
|
+
|
|
108
|
+
## [0.0.3-next.12](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.11...tools-core-v0.0.3-next.12) (2026-02-27)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Miscellaneous Chores
|
|
112
|
+
|
|
113
|
+
* **tools-core:** Synchronize repo versions
|
|
114
|
+
|
|
115
|
+
## [0.0.3-next.11](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.10...tools-core-v0.0.3-next.11) (2026-02-25)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Miscellaneous Chores
|
|
119
|
+
|
|
120
|
+
* **tools-core:** Synchronize repo versions
|
|
121
|
+
|
|
122
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.9...tools-core-v0.0.3-next.10) (2026-02-25)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* remove additionalProperties ([f9b5d81](https://github.com/twinfoundation/tools/commit/f9b5d81e952468f9579593cb979f2b84db6f0dfa))
|
|
128
|
+
|
|
129
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.8...tools-core-v0.0.3-next.9) (2026-02-24)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Miscellaneous Chores
|
|
133
|
+
|
|
134
|
+
* **tools-core:** Synchronize repo versions
|
|
135
|
+
|
|
136
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.7...tools-core-v0.0.3-next.8) (2026-02-23)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### Miscellaneous Chores
|
|
140
|
+
|
|
141
|
+
* **tools-core:** Synchronize repo versions
|
|
142
|
+
|
|
143
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.6...tools-core-v0.0.3-next.7) (2026-02-04)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Miscellaneous Chores
|
|
147
|
+
|
|
148
|
+
* **tools-core:** Synchronize repo versions
|
|
149
|
+
|
|
150
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.5...tools-core-v0.0.3-next.6) (2026-01-28)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### Miscellaneous Chores
|
|
154
|
+
|
|
155
|
+
* **tools-core:** Synchronize repo versions
|
|
156
|
+
|
|
157
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.4...tools-core-v0.0.3-next.5) (2026-01-06)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Miscellaneous Chores
|
|
161
|
+
|
|
162
|
+
* **tools-core:** Synchronize repo versions
|
|
163
|
+
|
|
164
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.3...tools-core-v0.0.3-next.4) (2026-01-05)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Miscellaneous Chores
|
|
168
|
+
|
|
169
|
+
* **tools-core:** Synchronize repo versions
|
|
170
|
+
|
|
171
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.2...tools-core-v0.0.3-next.3) (2025-11-11)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### Miscellaneous Chores
|
|
175
|
+
|
|
176
|
+
* **tools-core:** Synchronize repo versions
|
|
177
|
+
|
|
3
178
|
## [0.0.3-next.2](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.1...tools-core-v0.0.3-next.2) (2025-11-11)
|
|
4
179
|
|
|
5
180
|
|
|
@@ -93,4 +268,4 @@
|
|
|
93
268
|
|
|
94
269
|
* add support for auto expand types ([dd1e10a](https://github.com/twinfoundation/tools/commit/dd1e10a5b2fea6f80890ff6f3971f48e239cb4c1))
|
|
95
270
|
|
|
96
|
-
##
|
|
271
|
+
## Changelog
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tools Core Examples
|
|
2
|
+
|
|
3
|
+
This package provides the lower-level building blocks used by the CLI applications. The most common entry point is `TypeScriptToSchema`, which parses TypeScript declarations and returns JSON Schema documents keyed by title.
|
|
4
|
+
|
|
5
|
+
## Generate Schemas From TypeScript
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import type { IJsonSchema } from '@twin.org/tools-models';
|
|
9
|
+
import { TypeScriptToSchema } from '@twin.org/tools-core';
|
|
10
|
+
|
|
11
|
+
const converter = new TypeScriptToSchema();
|
|
12
|
+
const packageSchemas: { [id: string]: { [id: string]: IJsonSchema } } = {};
|
|
13
|
+
|
|
14
|
+
const generatedSchemas = await converter.generateSchema(
|
|
15
|
+
'https://schema.example.com/demo/',
|
|
16
|
+
'@example/demo-package',
|
|
17
|
+
packageSchemas,
|
|
18
|
+
'./dist/types/models.d.ts'
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
console.log(Object.keys(generatedSchemas));
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
When you already know the exported type you want, pass the type name instead of a file path. The helper resolves the declaration and returns the generated schema for that type together with any dependent schemas.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import type { IJsonSchema } from '@twin.org/tools-models';
|
|
28
|
+
import { TypeScriptToSchema } from '@twin.org/tools-core';
|
|
29
|
+
|
|
30
|
+
const converter = new TypeScriptToSchema();
|
|
31
|
+
const packageSchemas: { [id: string]: { [id: string]: IJsonSchema } } = {};
|
|
32
|
+
|
|
33
|
+
const generatedSchemas = await converter.generateSchema(
|
|
34
|
+
'https://schema.example.com/demo/',
|
|
35
|
+
'@example/demo-package',
|
|
36
|
+
packageSchemas,
|
|
37
|
+
'DemoRequest'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const requestSchema = generatedSchemas.DemoRequest;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Transform Generated Object Schemas
|
|
44
|
+
|
|
45
|
+
`TypeScriptSchemaObjectTransformer` helps when you need to adapt object schemas produced by the builder for utility types such as `Pick` and `Omit`, or when you want cleaner description text before serialising the result.
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import type { IJsonSchema } from '@twin.org/tools-models';
|
|
49
|
+
import { TypeScriptSchemaObjectTransformer } from '@twin.org/tools-core';
|
|
50
|
+
|
|
51
|
+
const transformer = new TypeScriptSchemaObjectTransformer();
|
|
52
|
+
|
|
53
|
+
const personSchema: IJsonSchema = {
|
|
54
|
+
title: 'Person',
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
id: { type: 'string' },
|
|
58
|
+
name: { type: 'string' },
|
|
59
|
+
email: { type: 'string', format: 'email' }
|
|
60
|
+
},
|
|
61
|
+
required: ['id', 'name', 'email']
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const publicPersonSchema = transformer.omitKeysFromObjectSchema(personSchema, ['email']);
|
|
65
|
+
const personSummarySchema = transformer.pickKeysFromObjectSchema(personSchema, ['id', 'name']);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
If your schema descriptions come from multiline source comments, `normalizeSchemaDescriptions` removes duplicated whitespace while keeping intentional line breaks intact.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import type { IJsonSchema } from '@twin.org/tools-models';
|
|
72
|
+
import { TypeScriptSchemaObjectTransformer } from '@twin.org/tools-core';
|
|
73
|
+
|
|
74
|
+
const transformer = new TypeScriptSchemaObjectTransformer();
|
|
75
|
+
|
|
76
|
+
const schemaWithDescription: IJsonSchema = {
|
|
77
|
+
type: 'object',
|
|
78
|
+
properties: {
|
|
79
|
+
status: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
description: 'Current status.\n\n Used in responses.'
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const normalisedSchema = transformer.normalizeSchemaDescriptions(schemaWithDescription);
|
|
87
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Class: Constants
|
|
2
|
+
|
|
3
|
+
Shared constants for TypeScript to JSON schema generation.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new Constants**(): `Constants`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`Constants`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### UNSUPPORTED\_UTILITY\_TYPE\_NAMES {#unsupported_utility_type_names}
|
|
18
|
+
|
|
19
|
+
> `readonly` `static` **UNSUPPORTED\_UTILITY\_TYPE\_NAMES**: `string`[]
|
|
20
|
+
|
|
21
|
+
Utility type names currently unsupported and mapped to open schemas with diagnostics.
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### ARRAY\_NUMBER\_TYPE\_NAMES {#array_number_type_names}
|
|
26
|
+
|
|
27
|
+
> `readonly` `static` **ARRAY\_NUMBER\_TYPE\_NAMES**: `string`[]
|
|
28
|
+
|
|
29
|
+
Native typed-array and binary type names mapped to JSON number arrays.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Class: DiagnosticReporter
|
|
2
|
+
|
|
3
|
+
Emits non-fatal diagnostics during schema mapping.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new DiagnosticReporter**(): `DiagnosticReporter`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`DiagnosticReporter`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### report() {#report}
|
|
18
|
+
|
|
19
|
+
> `static` **report**(`context`, `node`, `code`, `properties?`): `void`
|
|
20
|
+
|
|
21
|
+
Emit an optional non-fatal schema generation diagnostic.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### context
|
|
26
|
+
|
|
27
|
+
[`ITypeScriptToSchemaContext`](../interfaces/ITypeScriptToSchemaContext.md)
|
|
28
|
+
|
|
29
|
+
The generation context.
|
|
30
|
+
|
|
31
|
+
##### node
|
|
32
|
+
|
|
33
|
+
`Node`
|
|
34
|
+
|
|
35
|
+
The related AST node.
|
|
36
|
+
|
|
37
|
+
##### code
|
|
38
|
+
|
|
39
|
+
`string`
|
|
40
|
+
|
|
41
|
+
The diagnostic code.
|
|
42
|
+
|
|
43
|
+
##### properties?
|
|
44
|
+
|
|
45
|
+
The values to substitute into the localised message.
|
|
46
|
+
|
|
47
|
+
#### Returns
|
|
48
|
+
|
|
49
|
+
`void`
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Class: DisallowedTypeGuard
|
|
2
|
+
|
|
3
|
+
Validates whether a type node is allowed for schema generation.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new DisallowedTypeGuard**(): `DisallowedTypeGuard`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`DisallowedTypeGuard`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### getDisallowedTypeName() {#getdisallowedtypename}
|
|
18
|
+
|
|
19
|
+
> `static` **getDisallowedTypeName**(`typeNode`): `string` \| `undefined`
|
|
20
|
+
|
|
21
|
+
Resolve a disallowed type name from a type node.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### typeNode
|
|
26
|
+
|
|
27
|
+
`TypeNode`
|
|
28
|
+
|
|
29
|
+
The type node to inspect.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`string` \| `undefined`
|
|
34
|
+
|
|
35
|
+
The disallowed type name, if found.
|