| 5 | |
| 6 | const separator = ': ' |
| 7 | export class ObjectField implements ErrorBasicBuilder, Field { |
| 8 | hasError = false |
| 9 | constructor( |
| 10 | readonly name: string, |
| 11 | public value: Value, |
| 12 | ) {} |
| 13 | |
| 14 | markAsError() { |
| 15 | this.hasError = true |
| 16 | } |
| 17 | |
| 18 | getPrintWidth() { |
| 19 | return this.name.length + this.value.getPrintWidth() + separator.length |
| 20 | } |
| 21 | |
| 22 | write(writer: ErrorWriter): void { |
| 23 | const name = new FormattedString(this.name) |
| 24 | if (this.hasError) { |
| 25 | name.underline().setColor(writer.context.colors.red) |
| 26 | } |
| 27 | writer.write(name).write(separator).write(this.value) |
| 28 | } |
| 29 | } |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…