Skip to content

A TS to JS CLI interpreter. Includes features for minification as-well as custom src file path & streaming threshold.

License

Notifications You must be signed in to change notification settings

nomadicGopher/TypeScript_to_JavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions

  1. Download your OS's version of the program from Releases.
    • TypeScript_to_JavaScript.exe: Windows
    • TypeScript_to_JavaScript: Linux
  2. Add a scripts.ts file in the same directory, or remember to set the -file command-line-argument if it is outside the program's directory.
  3. Run the program with the following potential flags:
-file string
    Path to the TypeScript file. (default "scripts.ts")
-minify bool
    Minify the JavaScript output.
-stream float64
    File streaming minimum threshold in megabytes. (default 2.5)

Sample TypeScript content

// Define an interface for a Person
interface Person {
  firstName: string;
  lastName: string;
  age: number;
  greet(): string;
}

// Create a class that implements the Person interface
class Student implements Person {
  firstName: string;
  lastName: string;
  age: number;
  studentId: number;

  constructor(firstName: string, lastName: string, age: number, studentId: number) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.age = age;
    this.studentId = studentId;
  }

  // Implement the greet method
  greet(): string {
    return `Hello, my name is ${this.firstName} ${this.lastName} and I am ${this.age} years old.`;
  }

  // Additional method to get the student ID
  getStudentId(): number {
    return this.studentId;
  }
}

// Create an instance of the Student class
const student = new Student("John", "Doe", 20, 12345);

// Call the greet method
console.log(student.greet());

// Call the getStudentId method
console.log(`My student ID is ${student.getStudentId()}.`);

About

A TS to JS CLI interpreter. Includes features for minification as-well as custom src file path & streaming threshold.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages