Elements can be namespaces; Static properties and methods

This commit is contained in:
dcodeIO
2017-12-15 02:50:55 +01:00
parent b69c07af45
commit 8085a02df3
8 changed files with 460 additions and 224 deletions

9
tests/compiler/class.ts Normal file
View File

@ -0,0 +1,9 @@
class Animal {
static MAX: i32 = 1;
static add(a: i32, b: i32): i32 { return a + b; }
static sub<T>(a: T, b: T): T { return a - b; } // tsc does not allow this
}
Animal.MAX;
Animal.add(1,2);
Animal.sub<f32>(1.0, 2.0);