Jared Kushner, former President Donald J. Trump’s son-in-law and senior adviser, was diagnosed with thyroid cancer while he was serving in the West Wing, he wrote in an upcoming memoir set to be published next month.

“On the morning that I traveled to Texas to attend the opening of a Louis Vuitton factory, White House physician Sean Conley pulled me into the medical cabin on Air Force One,” Mr. Kushner wrote in “Breaking History: A White House Memoir,” to be published on Aug. 23, according to an excerpt about his illness provided to The New York Times.

“‘Your test results came back from Walter Reed,’ he said. ‘It looks like you have cancer. We need to schedule a surgery right away.’”

Mr. Kushner wrote that he asked the doctor to wait and come to his office the next day. “Please don’t tell anyone — especially my wife or my father-in-law,” he said he told Dr. Conley.

The cancer in Mr. Kushner’s thyroid was detected in October 2019, as he was involved in discussions over a trade deal with China.

Mr. Kushner wrote that the cancer was caught “early” but required removing a “substantial part of my thyroid” and that he was warned that there could be lingering damage to his voice.

His illness was one of the few pieces of information that did not leak out of one of the leakiest White Houses in modern memory.

Mr. Kushner wrote little in the book about why he did not make the information public, other than to say he worked to make sure a small circle was aware of it.

A doctor at NewYork-Presbyterian Hospital “concluded that I needed surgery to remove an unusual growth in my thyroid, and we scheduled the operation for the Friday before Thanksgiving,” he wrote. “That way, I would miss the least amount of time in the office. My absence might even go unnoticed. That’s how I wanted it.”

“This was a personal problem and not for public consumption,” he wrote. “With the exception of Ivanka, Avi, Cassidy and Mulvaney, I didn’t tell anyone at the White House — including the president,” he wrote, referring to his wife, Ivanka Trump; two of his aides; and Mick Mulvaney, then the White House chief of staff.

A person close to Mr. Mulvaney, after learning of the book’s reference to him, said he did not recall being told about Mr. Kushner’s condition.

Mr. Kushner was an assistant to the president and had a title, senior adviser, that only hinted at his omnipresent role in his father-in-law’s White House. Yet some veterans of previous administrations said that because Mr. Kushner was not an elected official, he had no obligation to disclose the information.

David Axelrod, the chief strategist in President Barack Obama’s White House, said that from his perspective, “if it didn’t affect his performance, it was a personal matter and he had no obligation to disclose it. Unlike any business entanglements or investments that might pose conflicts of interest, this was a personal, medical matter.”

In the excerpt, Mr. Kushner described concentrating on work and trying “not to think about the upcoming surgery or the unwanted growth in my body. When I did think about it, I reminded myself that it was in the hands of God and the doctors, and that whatever happened was out of my control. At moments, I caught myself wondering whether I would need extensive treatment.”

Mr. Trump was never known for his discretion about other people’s secrets. But while Mr. Kushner did not tell Mr. Trump of his diagnosis, he found out anyway, although he appeared not to have shared it.

“The day before the surgery, Trump called me into the Oval Office and motioned for his team to close the door. ‘Are you nervous about the surgery?’ he asked,” Mr. Kushner wrote.

“How do you know about it?” Mr. Kushner responded.

“I’m the president,” Mr. Trump replied, according to Mr. Kushner. “I know everything. I understand that you want to keep these things quiet. I like to keep things like this to myself as well. You’ll be just fine. Don’t worry about anything with work. We have everything covered here.”