The easiest way is probably with a mask similar to your second example.
- Create text.
- Duplicate text (Ctrl+d).
- Set duplicate's fill to white and stroke to black.
- Set duplicate's stroke width to an appropriate amount.
- Select both objects.
- Go to the Object menu, Mask -> Set.
To edit the text, you'll have to release the mask, delete the duplicate, and redo the steps above. To change the "thinning" amount, you'll have to release the mask, adjust the duplicate's stroke width, and set the mask again.
There are ways to set it up so that you never need to release the mask to make either of those changes, but they're pretty involved, so I wouldn't bother with that unless you see yourself have to edit the text and/or change the thinning amount a lot