DEV Community


Discussion on: TypeScript is slow. What can we do about it?

sharpninja profile image
The Sharp Ninja

There is no need to check a type unless it's declaration changes or it is being referenced as a different type than its declaration. In all other cases there's nothing to infer, the IDE already has the correct type for the object. With TypeScript you can disable strict typing for object that are implicitly typed as Any and thus create a situation where the IDE cannot know the type and must ask the language server to infer the type, which will probably come back as Any.

Thread Thread
alekseiberezkin profile image
Aleksei Berezkin Author

any works the opposite way 😀 any tells TS and IDE to stop inferring or checking a type of a var. Thus, if your code is full of anys, compilation will be the fastest. In my example there's not a single any, all types are strict.