2 ms·
YES! I use that myself! It's the only way to extend an existing type from different modules. Use an interface and make use of the automatic declaration merging,
by nosianu 3y ago
YES! I use that myself! It's the only way to extend an existing type from different modules. Use an interface and make use of the automatic declaration merging, and for that to be triggered it needs to be in the same namespace. Which since modules are each their own namespace needs the "namespace" declaration.
But that is for TYPES and does not produce any JS code!
> Similarly, enums are not semantically equivalent to object literals with const fields
I know and I mentioned it! That still does not make them needed! You can use them if you want. As I mentioned.
> I think it's kind of absurd to say that one of the most useful things in the TS type system is "not needed.
I on the other hand think it's absurd to pretend to have a serious discussion when you claim that enums are "one of the most useful things" in TS. Some very minor syntactic sugar add-on as one of the main points of type checks???