Delete an empty line

Say I have a line like this: Line {from: 0, to: 0, number: 1, text: ''}
It’s empty; just a new line.

How can I delete that line?

The from and to are the same, so this doesn’t really do anything:

view.dispatch({
  changes: {
    from: line.from,
    to: line.to,
    insert: "",
  }
});

And if I do to: line.to + 1, it messes up a line Decoration on the next line.

What’s the proper way to remove that empty line?

Either remove the line break before or after the line. And yes, you’ll have to take care about corner cases for the start and end of the document, and indeed, removing the line break after the line will remove line decorations associated with the next line.

So the only way to remove the entire line and not leave an empty line is this?

view.dispatch({
  changes: {
    from: line.from,
    to: line.to + 1,
    insert: "",
  }
});

Can you clarify why removing a newline removes line decorations on the next line?
Any way to “restore” those line decorations? As per Easily track & remove content with decorations, I’m storing them all in a StateField, but based on my understanding, after those changes are applied the line decoration will have already been removed.

They are technically associated with the position before the line, and deleting that drops them, which is usually what you want to happen when merging lines.