mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-16 00:11:28 +00:00
Elements can be namespaces; Static properties and methods
This commit is contained in:
9
tests/compiler/class.ts
Normal file
9
tests/compiler/class.ts
Normal 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);
|
Reference in New Issue
Block a user