DEV Community


Discussion on: TypeScript's Secret Parallel Universe

svijaykoushik profile image
Vijay Koushik, S. 👨🏽‍💻

This is surprising. I, being a beginner in TypeScript thought that types were implicitly tied with the classes I defined. I thought types worked similar to Java where one imports a class also imports the type implicitly. Thanks for pointing out the "secret" in typescript.

loilo profile image
Florian Reuschel Author

Your assumption is not wrong though! If a class has been declared in TypeScript, its value and its type do implicitly exist under the same name, therefore they're also imported together

But this is a rather special case for classes, most (all?) other entities do not create an implicit type alongside them.