Skip to content

How to suppress warnings

This article helps you to suppress warning messages generated by TypeSpec and libraries.

Symptoms

TypeSpec core and libraries could generate and output warning messages based on linting rules.

Cause

These linting rules are introduced to ensure high-quality specs being generated. Sometimes they are used to call out areas needs developer attention to meet library or organization guidelines.

Workaround

Some of the rules after review can be suppressed to get clean compile outputs using #suppress ErrCode ReasonMsg statement. The error code is the string reported in compiler output.

For example:

#suppress "@azure-tools/typespec-providerhub/no-identifier-property-in-array-item" "Error items have no unique identifier."
/** An array of details about specific errors that led to this reported error. */
details: Error[];