You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to add some additional thoughts to this issue as they might be relevant.
I've found that even though modules are now preffered way to compose code over namespaces, there is still one feature, which doesn't allow to completely replace them.
It is an ability to structure types. In almost any application there is kinds of types.
Types for modeling data (Tag)
Types for modeling component properties in React (TagProps)
Types for modeling callback data and functions - events (TagEvents)
If using only modules it's not possible to structure these kinds of types and addtional suffix (like <ComponentName>Props) have to be used to distinguish between them.
For example, I came up to this type structure in my app:
What about adding type namespaces which will only allow to use types / interfaces inside them?They can also be nested to better structure type hierarchy.
TypeScript Version: 3.8.0-dev.20200123
Search Terms: type only import merged namesapce
Code
Expected behavior:
Actual behavior:
Cannot use namespace 'Foo' as a type.
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: