Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clean typescript cache?

I don't know where to look at, and typescript answer here said that it is not cached

But it clearly cached the files. because this is my import

import definition

And yet, it cannot import the file from old path.

Cannot find module

I have searched for all definition.ts file, and all has been updated

Definition search

I am lost here..

like image 713
Magician Avatar asked Sep 03 '18 09:09

Magician


2 Answers

@tl;dr Usually when this sort of thing happens to me, deleting the build/lib/dist directory or whatever you call it, solves the issues.

This usually happens to me when I have something like:

file.ts

and,having previously built something, rename it to a directory such as:

file/index.ts

Since renaming files wont delete them in the ./lib directory(or whatever you call it in your project), unless you delete said directory and re-build, you will have entries:

file.ts
file/index.ts

Which (at least for me) often leads to such type of errors.

like image 86
Alexandre Dias Avatar answered Oct 18 '22 08:10

Alexandre Dias


If you are using VSCode, you can use CTRL + SHIFT + P to open the command palette and search for Typescript, you should have "Reload TS Server" and "Reload Project", both work well.

like image 30
laian Avatar answered Oct 18 '22 10:10

laian