Welcome to Super.js
Super.js is a strict, clean, and efficient superset of JavaScript that enforces ECMA standards with built-in type safety, formatting, linting, and testing capabilities.
🚀 Latest Version: This documentation is for the current development version (0.2.0+). For stable releases, see version 0.2.0 or version 0.1.0.
What is Super.js?​
Super.js extends JavaScript with static type checking while maintaining pure JavaScript semantics. It provides TypeScript-like type safety with a focus on ECMA compliance and zero-configuration development experience.
Key Features​
- Type Safety: Static type checking with JavaScript-first approach
- Type Inference: Smart type inference based on ECMA standard patterns
- Built-in Tooling: Integrated formatter, linter, and testing framework
- Universal Compilation: Supports both frontend and backend environments
- Zero Configuration: Works out of the box with sensible defaults
- Fast Compilation: Optimized compilation process for quick development cycles
- JavaScript Version Selection: Target specific JavaScript versions (ES5 to ES2022)
- Native JSX Support: First-class JSX syntax support without external dependencies
- Advanced Type System: Conditional types, mapped types, and type guards
- Performance Optimizations: Incremental compilation and parallel processing
Quick Start​
Installation​
npm install -g superjs
Creating a new project​
superjs init my-project
cd my-project
Your first Super.js file​
Create a file with the .sjs
extension:
// hello.sjs
function greet(name: string): string {
return `Hello, ${name}!`;
}
const message = greet("World");
console.log(message);
Compiling and running​
# Compile the file
superjs build --source hello.sjs
# Run the compiled JavaScript
node hello.js
File Extension​
Super.js files use the .sjs
extension and support type annotations:
// example.sjs
interface User {
name: string;
age: number;
email?: string; // Optional property
}
class UserAccount {
constructor(public user: User) {}
updateEmail(newEmail: string): void {
this.user.email = newEmail;
}
}
// Type inference
const numbers = [1, 2, 3]; // inferred as number[]
const user = {
name: "John",
age: 30
}; // inferred as { name: string, age: number }
JavaScript Version Targeting​
You can target specific JavaScript versions using the --target
option:
# Target ES5
superjs build --source file.sjs --target es5
# Target ES2015 (ES6)
superjs build --source file.sjs --target es2015
# Target ES2020
superjs build --source file.sjs --target es2020
# Default (ES2022)
superjs build --source file.sjs
Supported JavaScript versions:
- es5
- es2015 (ES6)
- es2016
- es2017
- es2018
- es2019
- es2020
- es2021
- es2022 (default)
Development Workflow​
Development mode with watch​
superjs dev
Running tests​
superjs test
Formatting code​
superjs format
Linting code​
superjs lint
What's Next?​
- Language Reference - Learn about Super.js syntax and features
- Examples - See practical examples and use cases
- Type System - Deep dive into the type system
- Tooling - Learn about built-in tools and configuration
Version Information​
This documentation covers the latest development version of Super.js. For specific version documentation:
- 0.2.0 - Enhanced type system and tooling (stable)
- 0.1.0 - Initial stable release
- 0.0.1 - Initial alpha release
Latest Features​
The current version includes the latest enhancements:
- Advanced Type System: Conditional types, mapped types, and type guards
- Performance Improvements: Incremental compilation and parallel processing
- Enhanced Tooling: Better error messages and development experience
- Source Map Support: Full debugging capabilities
- Decorator Support: Experimental decorator implementation