Skip to content

[F] setMediaTypeHint

function setMediaTypeHint(
program,
target,
mediaType): void;

Sets the default media type hint for the given target type.

This value is a hint ONLY. Emitters are not required to use it, but may use it to get the default media type associated with a TypeSpec type.

If a type already has a default media type hint set, this function will override it with the new value.

WARNING: this function will throw an error if the provided media type string is not recognized as a valid MIME type.

ParameterTypeDescription
programProgramthe Program containing the target
target| Enum | Model | Scalar | Unionthe target to set the MIME type hint for
mediaTypestringthe default media type hint to set for the target

void

if the provided media type string is not recognized as a valid MIME type