As the title suggests, I'm looking for help on what features/extensions I might look to disable in order to resolve a specific issue with the Visual Studio 2017 IDE (Windows).
When I'm working in Typescript the following will cause a node.js process to spike CPU usage and make the IDE lock up for several seconds with each keystroke. It happens when filling in the paths for import and export statements, e.g.:
import { foo } from 'app/file/bar';
export { foo } from 'app/file/bar';
Once I start typing 'app/file/bar'
everything goes to hell. Windows resource monitor shows Node.exe spiking to almost 100% cpu. Its almost like it is scanning my entire project with each keystroke so that it can try and suggest auto-complete options (but nothing ever shows up, everything just chokes).
I've made sure my tsconfig
excludes node_modules
.
Please help - I have so much work to get done!
Use import myFunction from "./myModule" to bring it in. More commonly, TypeScript modules say export myFunction in which case myFunction will be one of the properties on the exported object. Use import { myFunction } from "./myModule" to bring it in.
Export in TypeScript There is a simple design/compile time tool that you can use to stop your TypeScript code from accessing things it should not. With the export keyword, JavaScript adds a line to include the exported item to the module. There are two types of export statements: export default and normal export .
TypeScript supports export = to model the traditional CommonJS and AMD workflow. The export = syntax specifies a single object that is exported from the module. This can be a class, interface, namespace, function, or enum.
To use TypeScript with ES Modules, the TypeScript compiler configuration in tsconfig. json can be updated to process code in ES Module format. Additionally, Babel can be used for TypeScript compilation, and the TypeScript compiler will be used for type checking, as Babel can not type check TypeScript code.
Try installing Typescript 2.4.1 which was released 2 days ago.
This commit to the Typescript repository indicated that it would optimise the module resolution process, which should affect performance when modifying imports. After installing it I have found the performance to be much better.
I had the same issue as you (~20-30 second lag when modifying imports) but now the lag is minimal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With