Is that an overrated principle about writing fiction? I recently showed an in-progress short story about abortion to friends of mine. One told me to focus on writing what I know.
Not to say I’m him, but I recall that Stephen King has written both Rita Hayworth and the Shawshank Redemption and The Green Mile, even though he’s never been on death row or even in prison.
I think the solution is this: write about what you know but also leave open the possibility of writing what interests you. If what interests you is outside your realm of expertise, then consult an expert and interview them.
If, for example, I were to write an article about an African-American man with an amazing penchant for repairing decrepit vehicles back in Texas in the 1930s, I’d speak to these people–my father, a retired mechanic, a man named Steve who has an auto shop and is literally a walking encyclopedia when it comes to engines, and perhaps African-Americans or historians who can give me insight on what it was like being black in Texas back in those days.