Fix typehint for upsert method