We stand on the shoulders of open technology and it’s our turn to give back. We see the strength of N4JS not only for our own platform but as a foundation for others to build upon. This is why we release N4JS as open-source. We are excited for feedback and always open for contributions!
N4JS is an extension of ECMAScript making it is as different from Java as ECMAScript itself. N4JS does add features which are quite similar to Java and the general idea is to make ECMAScript as type safe as Java. For that reason, N4JS adds a static type system to ECMAScript, many concepts of which are similar to Java’s type system.
We created N4JS with the goal to enable writing large ECMAScript projects that are as maintainable as Java. To do this, we took the Java type system and adjusted it to ECMAScript’s characteristics. The N4JS type checker is rigorous: type errors are not accepted. Where TypeScript also adds a static type system on top of ECMAScript, their approach is quite the opposite in that their goal is to enable a smooth transition from untyped to typed ECMAScript. The type checker in TypeScript makes some compromises in order to accept more ECMAScript code.
Eventually both approaches will lead to similar solutions: The smarter and better the type checker of N4JS becomes, the more programs it will accept without losing its soundness. The smarter and better TypeScript’s type checker becomes, the less gaps there will be for incorrect ECMAScript code.
For a thorough explanation of the differences and similarities between N4JS and TypeScript see our comparison page.