Optimal generalisation and learning transition in extensive-width shallow neural networks near interpolation