@typespec/http-server-csharp
Version:
TypeSpec service code generator for c-sharp
44 lines • 1.83 kB
TypeScript
import { Enum, IndeterminateEntity, ModelProperty, Program, Scalar, Type, Value } from "@typespec/compiler";
import { CSharpType } from "./interfaces.js";
/**
* Utility function to determine if a given type is a record type
* @param program The program to process
* @param type The type to check
* @returns true if the type is a Record<T>, or false otherwise
*/
export declare function getRecordType(program: Program, type: Type): Type | undefined;
export type EnumValueType = "string" | "int" | "double";
export declare function getDoubleType(): CSharpType;
export declare function getEnumType(en: Enum): EnumValueType | undefined;
/**
* Determines if the type is an array type
* @param program The program to process
* @param type The type to check
* @returns true if the type is an array or a model property with array type, otherwise false
*/
export declare function isArrayType(program: Program, type: ModelProperty | Scalar): boolean;
/** Inner representation of s string constraint */
export interface StringConstraint {
minLength?: number;
maxLength?: number;
pattern?: string;
}
/**
* Returns the string constraints for the given type
* @param program The program to process
* @param type A model property or scalar to check
* @returns The string constraint
*/
export declare function getStringConstraint(program: Program, type: ModelProperty | Scalar): StringConstraint | undefined;
/**
* Returns an unknown type
* @param program The program to check
* @returns an unknown type
*/
export declare function getUnknownType(program: Program): Type;
/**
* Determines if the given type is a known value or literal type
* @param program
*/
export declare function isKnownReferenceType(program: Program, type: Type | Value | IndeterminateEntity): boolean;
//# sourceMappingURL=type-helpers.d.ts.map