Sophie Giannamore also had a significant role on Amazon’s “Transparent.”

[Editor’s Note: The following contains spoilers from “The Good Doctor” episode titled, “She.”]

On Monday’s episode of “The Good Doctor,” Sophie Giannamore guest stars as a young transgender girl who comes to San Jose St. Bonaventure Hospital with a medical emergency. What’s significant about this casting is that Giannamore is actually a transgender actress in real life.

In the episode, Giannamore plays Quinn, a young girl who comes in with abdominal pains, but when she’s examined and found to have a penis, Dr. Shaun Murphy (Freddie Highmore) is confused about why she identifies as female. He continues to use male pronouns “he” and “him” to refer to Quinn, and insists that biology is the only way to determine someone’s gender.

Shaun’s natural curiosity leads him to ask some awkward “inflammatory” questions that his colleagues would prefer he avoid altogether. But it’s through this questioning and candid conversations with Quinn that Shaun is able to adjust his preconceived notions and see her point of view to the best of his ability, eventually calling her a girl and using her preferred pronouns.

Quinn’s description of body dysmorphia and being judged by her exterior while she feels the opposite inside strikes a chord with him. Not only does Shaun identify with Quinn’s outsider status, but her passionate testimonial about how getting her gender confirmed finally gave her a feeling of peace and freedom (as if she were floating in a pool) causes Shaun to reflect on his own feelings of identity. Perhaps the narrative that other people have been giving him — of a brilliant surgeon with autism — is too limited and one that perhaps he’s bought into over the years. At the end of the episode, he goes to the swimming pool to seek out that elusive feeling of being at harmony with the outside world.

ABC

The episode continues the show’s ongoing themes about challenging prejudices (especially one’s own), foster better understanding, and question how we accept or reject narratives in our own identity. A big part of how these stories get to be told are amplified by the show’s inclusive storytelling and casting.

Hiring Giannamore is just the latest smart casting move by a show that has set out to give better representation to marginalized people on the screen. When Highmore, a neurotypical actor, was initially cast to play a surgeon who has autism and savant syndrome, critics felt that an actor with autism should’ve been tapped, despite Highmore’s acclaimed portrayal. Since then, however, the show has continued with its diverse casting in all roles, and even featured an actor with autism to play a patient who has autism.

Having Giannamore (who has also portrayed young Maura on “Transparent”) play the part also lends specificity and accuracy to the role. The actress first came out as transgender around age 11, and in a YouTube video has shared her experiences, including how she used puberty blockers, which is a detail given to her character Quinn as well. Giannamore’s story is particularly important because she’s still a child, but one who’s been able to assert her own identity when many would write her feelings off as merely “confused” immaturity. Similarly, on “The OA,” Ian Alexander plays an out, transgender teenage boy. He is also the only transgender Asian American actor on TV.

Giannamore’s casting is heartening news for the transgender community, who have often seen their roles played by cisgender actors, which not only is bad for representation, but can also be a dangerous perception to perpetuate. While “Transparent,” “Orange Is the New Black,” and “The OA,” have led the charge in casting transgender actors to play those roles, the networks have been a little bit behind. However, Giannamore and Candis Cayne over on “Grey’s Anatomy” (also on ABC) are the latest transgender casting triumphs on broadcast.

“The Good Doctor” airs on Mondays at 10 p.m. ET on ABC.

Sign Up: Stay on top of the latest breaking film and TV news! Sign up for our Email Newsletters here.