I have an Anker charging cable and when I plug in, to either the iPad or a third party charger, it does charge, but when I unplug it, a spark flies, or I hear crackling near the end of the USB-C cable!! Very odd.
I suspect there is some grounding or other type of issue that causes a charge buildup. I thought maybe I misheard it or imagined it the first time, or perhaps it was a physical "crinkling" from the hinge - but I've done it maybe 3-4 times now, and I've heard the crackling each time, and seen a spark twice. Oddly, it actually happens at both ends of the USB-C cable - even after unplugging at the magic keyboard, if I unplug the other end of the cable, from the charger, I hear a similar sound. Maybe there are some very simple/small IC/circuits, near the ends of the cable that are building up charge somehow.
This scares me a bit, in terms of it damaging the iPad or keyboard, so I am only using the apple cable now - which works well and doesn't have the issue, with either the third party charger, or the Apple charger... it appears to be only cable related - very strange.