Trader Joe's is fine for party goods and frozen foods. Their produce selection is quite small, though, and, at least at the Arlington Heights store, doesn't turn over fast enough. I certainly don't buy everyday groceries there.
While Costco isn't, either, it is a place where we stock up on certain items. Of the things I buy at Costco that are also available at TJ, prices are much lower at Costco. Specific examples include cheese, sausages and deli meats, typically the same brands.
I don't buy much produce at Costco, though, because of the quantities required. With just two of us, I try to buy small amounts of perishables.
However, in the case of things like potatoes and onions, I've been annoyed to find that it's more cost-effective to buy more than I need and be prepared to throw out what goes bad than to buy in small amounts. That seems to be true no matter where you buy them.
Since it's convenient for us to buy gasoline at Costco, our membership is justified no matter what.