Jason Rosenhouse has
an interesting post about whether or not fiction is a valid way of knowing something about the world.
Ultimately I agree with him (except for his ranking of Star Trek captains). Yes, literature contains truths about the human condition and about the world in general. Otherwise it would have a lot less value. But it also often contains falsehoods, or overgeneralizations.
Literature (and narrative media in general) can be extremely useful to help elucidate, proselytize, or reinforce existing beliefs. But I don't think it functions as a
primary source of knowledge. A metaphor can help reinforce some aspects of how the world works. For example, one could tell a story about how white blood cells are the knights of the realm, ever vigilant in capturing and slaying unwanted intruders. Many things about the metaphor may ring true, and align well with the actual state of affairs. But we can't
know how the immune system works from such stories. That takes painstaking investigation of the phenomenon itself.
Something in a work of fiction might "ring true", but there's no way to validate it within the framework of the story itself. You'd be surprised how many people overseas think that every American owns a gun from watching our movies. If I gleaned universal truths from Judd Apatow films, I'd live in a world where fat, unemployed stoner shlubs hooked up with super-hot TV personalities and lived happily ever after. How do I know the world does not work this way? By comparing the vision of the story with the actual state of affairs.
So I think it makes the most sense to view literature, and really all art, as a way of reframing truths to make them more interesting, accessible, etc., but ultimately not as a source of truth.