A strict, clean, and efficient superset of JavaScript that enforces ECMA standards with built-in type safety, formatting, linting, and testing capabilities.
- π Type Safety: Static type checking with JavaScript-first approach
- π§ Smart Type Inference: Automatic 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 Targeting: 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
npm install -g superjs
superjs init my-project
cd my-project
Create a file with the .sjs
extension:
// hello.sjs
function greet(name: string): string {
return `Hello, ${name}!`;
}
const message = greet("World");
console.log(message);
# Compile the file
superjs build --source hello.sjs
# Run the compiled JavaScript
node hello.js
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 }
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)
superjs dev
superjs test
superjs format
superjs lint
// hello-world.sjs
const message: string = 'Hello, SuperJS!';
const version: number = 0.1;
const isEnabled: boolean = true;
interface Person {
name: string;
age: number;
email?: string;
}
function greet(person: Person): string {
return `Hello, ${person.name}! You are ${person.age} years old.`;
}
// classes.sjs
interface Vehicle {
brand: string;
model: string;
year: number;
start(): void;
}
class Car implements Vehicle {
constructor(
public brand: string,
public model: string,
public year: number
) {}
start(): void {
console.log(`${this.brand} ${this.model} is starting...`);
}
}
// generics.sjs
interface Repository<T> {
find(id: number): T | null;
save(item: T): void;
delete(id: number): boolean;
findAll(): T[];
}
class UserRepository implements Repository<User> {
private users: User[] = [];
find(id: number): User | null {
return this.users.find(user => user.id === id) || null;
}
save(user: User): void {
const existingIndex = this.users.findIndex(u => u.id === user.id);
if (existingIndex >= 0) {
this.users[existingIndex] = user;
} else {
this.users.push(user);
}
}
}
super-js/
βββ compiler/ # JavaScript-based compiler implementation
βββ docs/ # Documentation site (Docusaurus)
βββ examples/ # Example Super.js files
βββ llvm/ # LLVM-based compiler implementation
βββ prototype/ # TypeScript-based prototype implementation
βββ README.md
- 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
- Node.js >= 14.0.0
- npm or yarn
git clone https://github.com/your-username/super-js.git
cd super-js
npm install
npm run build
npm test
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
We welcome contributions! Please see our Contributing Guide for details.
- π§ Email: support@superjs.dev
- π¬ Discord: Join our community
- π Documentation: docs.superjs.dev
- π Issues: GitHub Issues
- Built with β€οΈ by the Super.js team
- Inspired by TypeScript and modern JavaScript development practices
- Thanks to all our contributors and the open-source community
Super-JS - Making JavaScript development safer, faster, and more enjoyable! π