Created
August 20, 2019 13:19
-
-
Save dentmaged/2448b5fe1eacca919b1a5d93b058757c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| comp:betterscript-test will$ npm run dev | |
| > betterscript@1.0.0 dev /Users/will/Desktop/betterscript-test | |
| > cd ../betterscript && tsc && cd ../betterscript-test && npm start | |
| > betterscript@1.0.0 start /Users/will/Desktop/betterscript-test | |
| > bsc && tsc && node ts-dist/test.js | |
| Testing environment. | |
| 8 | |
| 100 | |
| 100 | |
| 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /betterscript/bin/bsc: | |
| # #!/usr/bin/env node | |
| # require('../dist/compiler.js') | |
| ln -s -f /Users/will/Desktop/betterscript/bin/bsc $PWD/node_modules/.bin/bsc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| boolean prod = false; | |
| interface IUser { | |
| string username; | |
| number permission; | |
| } | |
| class User implements IUser { | |
| public string username; | |
| private string password; | |
| private number _permission; | |
| number internalID; | |
| constructor(number internalID) { | |
| this.internalID = internalID; | |
| if (internalID === 0) | |
| this._permission = 100; | |
| } | |
| public set permission(number permission) { | |
| if (permission < 0) | |
| return; | |
| this._permission = permission; | |
| } | |
| public get number permission() { | |
| return this._permission; | |
| } | |
| } | |
| number add(number a, number b) { | |
| return a + b; | |
| } | |
| void test() { | |
| if (!prod) | |
| console.log("Testing environment."); | |
| console.log(add(5, 3)); | |
| User admin = new User(0); | |
| User user = new User(1); | |
| console.log(admin.permission); | |
| admin.permission = -10; | |
| console.log(admin.permission); | |
| user.permission = 1; | |
| console.log(user.permission); | |
| } | |
| test(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var prod: boolean = false; | |
| interface IUser { | |
| username: string; | |
| permission: number; | |
| } | |
| class User implements IUser { | |
| public username: string; | |
| private password: string; | |
| private _permission: number; | |
| internalID: number; | |
| constructor(internalID: number) { | |
| this.internalID = internalID; | |
| if (internalID === 0) | |
| this._permission = 100; | |
| } | |
| public set permission(permission: number) { | |
| if (permission < 0) | |
| return; | |
| this._permission = permission; | |
| } | |
| public get permission(): number { | |
| return this._permission; | |
| } | |
| } | |
| function add(a: number, b: number): number { | |
| return a + b; | |
| } | |
| function test(): any { | |
| if (!prod) | |
| console.log("Testing environment."); | |
| console.log(add(5, 3)); | |
| var admin: User = new User(0); | |
| var user: User = new User(1); | |
| console.log(admin.permission); | |
| admin.permission = -10; | |
| console.log(admin.permission); | |
| user.permission = 1; | |
| console.log(user.permission); | |
| } | |
| test(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment