question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overwrite when calling createSourceFile

See original GitHub issue

After a quick search, I’ve found that apparently this option was considered for some operations but not for all, such as save and saveSync. It would be nice if we could overwrite when saving a file.

Seems to me like I have to manually delete the file, maybe there’s another way?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
dsherretcommented, Mar 29, 2018

This is available now in 10.0.1.

2reactions
dsherretcommented, Mar 26, 2018

This will be in the next release (tomorrow evening probably Edit: Nevermind, need to finish the other issues in the version 10 milestone… sometime this week or next).

const sourceFile = project.createSourceFile("/file.ts", "", { overwrite: true });

In the future, there will probably be more options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding Source Files - ts-morph
createSourceFile will throw an error if the file already exists. To not throw an error, set the overwrite option to true. const sourceFile...
Read more >
java - Code replacement with an annotation processor
This allows you to override/divert calls to the target class. So if this is your input class: InputImpl.java:
Read more >
Filer (Java Platform SE 8 ) - Oracle Help Center
This interface supports the creation of new files by an annotation processor. Files created in this way will be known to the annotation...
Read more >
Create C Source MEX File arrayProduct.c - MATLAB & Simulink
This example shows how to write a MEX file to call a C function arrayProduct in MATLAB ® ... Replace the int declaration...
Read more >
Processing TypeScript using TypeScript - Convinced Coder
createSourceFile ( filename, code, ts. ... As you can see, the getSourceFile method of the CompilerHost is called twice: once for getting the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found