If going untyped JS, then you don't have the same restrictions as Java.
If going typed, then the TypeScript type-system is more powerful than Java's.
If going untyped JS, then you don't have the same restrictions as Java.
If going typed, then the TypeScript type-system is more powerful than Java's.