Skip to main content
Version: Next 🚧

[F] typespecTypeToJson

function typespecTypeToJson<T>(typespecType, target): [T | undefined, Diagnostic[]]

Convert a TypeSpec type to a serializable Json object. Emits diagnostics if the given type is invalid

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
typespecTypeTypeSpecValueThe type to convert to Json data
targetDiagnosticTargetThe diagnostic target in case of errors.

Returns

[T | undefined, Diagnostic[]]