Setting textItem contents for an empty text layer via script changes the text layer formatting. Verified on both Windows 10 Pro and Mac Sequoia, Photoshop 26.4.1.
1. Create a new document.
2. Add a type layer with the text tool, type in a few characters
3. Manually set font and size formatting
4. Manually select and delete the text, clicking the checkmark in the Options bar to leave a blank type layer
5. Run the following code snippet:
var docRef = app.activeDocument;
var layerRef = docRef.activeLayer;
var textRef = layerRef.textItem;
textRef.contents = Window.prompt('Enter text');
Result: The text size and font will change to Myriad Pro 9 point. This is regardless of the setting in Preferences/Settings->Type->Set default font size automatically
Expected: Size and font will remain the same
Double-clicking the type layer in the Layers panel and then manually typing in characters retains the previous formatting