Tighten stdlib typespecs to match implementations (#15561)