-
Notifications
You must be signed in to change notification settings - Fork 2k
TypeScript Output
Aurélio A. Heckert edited this page May 3, 2020
·
15 revisions
This is a living document to assemble product requirements for potential TypeScript output from the CoffeeScript compiler.
If the CoffeeScript compiler were to output TypeScript source code, similar to the way it outputs JSX now, what TypeScript syntax should it support?
It’s a separate question what CoffeeScript syntax will be designed to support each TypeScript syntax; for now we just want to create a list of output syntax that we eventually want to support.
function greeter(person: string) {}
class Student {
fullName: string;
constructor(public firstName: string, public middleInitial: string, public lastName: string) {}
}
let list: Array<number> = [1, 2, 3];
interface Person {
firstName: string;
lastName: string;
}
type WindowStates = "open" | "closed" | "minimized";
type BotId = string | number
function buildName(firstName: string, lastName?: string) {
if (lastName) return firstName + " " + lastName;
else return firstName;
}
class Animal {
private id: string;
protected name: string;
public constructor(theName: string) {
this.name = theName;
}
public move(distanceInMeters: number) {
console.log(`${this.name} moved ${distanceInMeters}m.`);
}
}
class Octopus {
readonly name: string;
readonly numberOfLegs: number = 8;
constructor(theName: string) {
this.name = theName;
}
}