As Shadowmouse pointed out, you're using sf::Event::Keypressed for the erase condition. I would expect it to be the sf::Event::TextEntered condition - the same as the other test.
Just to be clear, the unicode for backspace is not sf::Keyboard::Backspace; it is indeed '\b'.
Can you not nest the conditions so that they are a bit clearer, like this:
void type(sf::Clock & clock, sf::String & string, sf::Event & event)
{
if (event.type == sf::Event::TextEntered && clock.getElapsedTime() >= sf::milliseconds(130))
{
clock.restart();
if (event.text.unicode == '\b')
string.erase(string.getSize() - 1);
else
string.insert(string.getSize(), event.text.unicode);
}
}
p.s. Jesper, there's only one event type here so there's nothing to switch