编译器配置项-compilerOptions
输出格式相关选项01
禁止截断错误信息 - noErrorTruncation
不要截断错误消息。
默认值为 false
,示例如下:
var x: {
propertyWithAnExceedinglyLongName1: string;
propertyWithAnExceedinglyLongName2: string;
propertyWithAnExceedinglyLongName3: string;
propertyWithAnExceedinglyLongName4: string;
propertyWithAnExceedinglyLongName5: string;
propertyWithAnExceedinglyLongName6: string;
propertyWithAnExceedinglyLongName7: string;
propertyWithAnExceedinglyLongName8: string;
};
// String representation of type of 'x' should be truncated in error message
var s: string = x;
Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propertyWithAnExceedinglyLongName3: string; propertyWithAnExceedinglyLongName4: string; propertyWithAnExceedinglyLongName5: string; propertyWithAnExceedinglyLongName6: string; propertyWithAnExceedinglyLongName7: string; propert...' is not assignable to type 'string'.
Variable 'x' is used before being assigned.
如果设置为 true
:
var x: {
propertyWithAnExceedinglyLongName1: string;
propertyWithAnExceedinglyLongName2: string;
propertyWithAnExceedinglyLongName3: string;
propertyWithAnExceedinglyLongName4: string;
propertyWithAnExceedinglyLongName5: string;
propertyWithAnExceedinglyLongName6: string;
propertyWithAnExceedinglyLongName7: string;
propertyWithAnExceedinglyLongName8: string;
};
// String representation of type of 'x' should be truncated in error message
var s: string = x;
Type '{ propertyWithAnExceedinglyLongName1: string; propertyWithAnExceedinglyLongName2: string; propertyWithAnExceedinglyLongName3: string; propertyWithAnExceedinglyLongName4: string; propertyWithAnExceedinglyLongName5: string; propertyWithAnExceedinglyLongName6: string; propertyWithAnExceedinglyLongName7: string; propertyWithAnExceedinglyLongName8: string; }' is not assignable to type 'string'.
Variable 'x' is used before being assigned.
保留观察模式下的输出 - preserveWatchOutput
这个选项配置监视模式下是否保留过时的控制台输出,而不是在每次发生更改时都清除控制台的输出。
美化输出 - pretty
使用颜色和上下文对错误或者消息进行样式化,默认情况下这个选项是启用的, - 为您提供了一个不那么简洁的机会, 来自编译器的单色消息。