ts-morph
ts-morph copied to clipboard
Using `set` on a node results in the node not being updated synchronously
When using set on an import declaration it results in the node not being updated synchronously. Using the specific setDefaultImport and insertNamedImport it does result in the node being updated synchronously as expected. I haven't been able to replicate this in a test environment unfortunately.
Here is example logs that are output. The add returns before it's complete, another request is then sent off the get the type data but because of the imports not being there anymore for a period of time it returns any.
import { Cake } from "./src/components/components";export function HelloWorld() {
return (
<>
<Cake /></>
);
}
could not find symbol mate
import "./src/components/components";export function HelloWorld() {
return (
<>
<Cake />
<Straw /></>
);
}
could not find symbol mate
import "./src/components/components";export function HelloWorld() {
return (
<>
<Cake />
<Straw /></>
);
}
could not find symbol mate
import { } from "./src/components/components";export function HelloWorld() {
return (
<>
<Cake />
<Straw /></>
);
}
could not find symbol mate
import { } from "./src/components/components";export function HelloWorld() {
return (
<>
<Cake />
<Straw /></>
);
}
import { Cake, Straw } from "./src/components/components";export function HelloWorld() {
return (
<>
<Cake />
<Straw /></>
);
}
Version: 17.0.1
To Reproduce
I need to figure out how best to replicate this, apologies.
Expected behavior
The set is synchronous so at the end of the function call its guaranteed to be updated.