In either case, the most important thing is to keep your wrists in as straight and neutral position as possible, with your palms and wrists "floating" rather than resting on anything while actively typing. Having the wrists either flexed downward or extended upward is a really bad idea. Having the wrists turned out to the side isn't great either, but not as bad.
The keyboard should be positioned close enough to your body so that your shoulders can be relaxed with your upper arms hanging loosely. The laptop surface should be roughly parallel to your forearms, so if you have a high desk or table relative to your torso you will need to prop up the far side to tilt it up a bit.