Measures Concepts
GitHub icon

Static Typescript

Static Typescript - Programming language

< >

Static Typescript is a programming language created in 2019.

#4047on PLDB 5Years Old

We present Static TypeScript (STS), a subset of TypeScript (itself, a gradually typed superset of JavaScript), and its compiler/linker toolchain, which is implemented fully in TypeScript and runs in the web browser.


Language features

Feature Supported Token Example
MultiLine Comments ✓
/* A comment
*/
Comments ✓
// A comment
Algebraic Data Type ✓
declare type numOrString = string | number
Line Comments ✓
// A comment
Union Types ✓
declare type numOrString = string | number
Single-Type Arrays ✓
const scores: int[]
Type Inference ✓
Strings ✓
"hello world"
Type Parameters ✓
function identity(arg: T): T {
   return arg;
}
Static Typing ✓
Inheritance ✓
class B {}
class A extends B {}
Print() Debugging ✓
console.log("Hi")
Namespaces ✓
// Typescript even supports splitting namespaces across multiple files:
// Validation.ts
namespace Validation {
    export interface StringValidator {
        isAcceptable(s: string): boolean;
    }
}
// LettersOnlyValidator.ts
/// 
namespace Validation {
    const lettersRegexp = /^[A-Za-z]+$/;
    export class LettersOnlyValidator implements StringValidator {
        isAcceptable(s: string) {
            return lettersRegexp.test(s);
        }
    }
}
Mixins ✓
// https://www.typescriptlang.org/docs/handbook/mixins.html
class SmartObject implements Disposable, Activatable {
}
// Note: still need to do some runtime ops to make that work.
Interfaces ✓
// https://www.typescriptlang.org/docs/handbook/interfaces.html
interface SquareConfig {
   color?: string;
   width?: number;
}
File Imports ✓
import { ZipCodeValidator } from "./ZipCodeValidator";
/// 
/// 
import moo = module('moo');
/// 
Type Casting ✓
something;
Classes ✓
class Person {}
Booleans ✓
const result = true
Generics ✓
function identity(arg: T): T {
   return arg;
}
Abstract Types ✓
abstract class Animal {}
class Dog extends Animal
Access Modifiers ✓
class Person {
  private _age = 2
  public get age() {
    return _age
  }
  protected year = 1990
}
Static Methods ✓
class Person {
  static sayHi() {
    console.log("Hello world")
  }
}
Enums ✓
enum Direction {
 Up,
 Down
}
Case Insensitive Identifiers X
Semantic Indentation X
Operator Overloading X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Day 605 · feedback@pldb.io · Logout