While it is possible to call ts.CreateSourceFile() or ts.UpdateSourceFile() passing in an empty file, either of those would leave the file name in
ts.CreateSourceFile()
ts.UpdateSourceFile()