Figured it out.
Went into the BIOS, power and volume up button. Turned off the type cover port. Rebooted and again rebooted into Bios, enabled the type cover port.
All OK.
This after I had the same issue and nothing I tried worked so I thought the typecover was broken and bought a new one.
Same issue!
Updated the drivers to SurfacePro4_Win10_15063_1704201_0.msi
Same issue!
I did the same many times. Didnt work at all
Tried fresh install as well. My type cover plugging into other SP4 works but none work with mine. I tried all the way and now end up carrying a bluetooth mouse and keyboard all the time.
Nicely done MSFT