Skip to content

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

License

Notifications You must be signed in to change notification settings

Arlen22/TypeScript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Fork of Typescript

This fork contains a few modifications to Typescript to preview the try-expression-proposal syntax. It is not intended to be used in production.

To play around with it for yourself

  • Create a new npm project folder using npm init.
  • npm install the built tgz file from the releases page of this repository.
  • In VSCode, create a new typescript file and open it to enable the Typescript engine, then run the command "Typescript: Select Typescript Version" and select the version from your node_modules folder.
  • Create a tsconfig.json file with strictNullChecks enabled.
  • If you run tsc it will just pass the syntax through to the Javascript file.

The following code should be valid

const [error, data]: TryResult<1> = try 1;
if (error) {
  const e: TryError = error;
  const r: undefined = data;
} else {
  const e: undefined = error;
  const r: 1 = data;
}
// try at the beginning of an arrow function body
const [error1, data1] = (() => try someExpression() ?? otherexpression() ? true : false)();
// regular assignment, terminated by comma, semicolon, or other statement.
const [error2, data2] = try someExpression() ?? otherexpression() ? true : false;
// used as an array value, terminated by comma or end of array
const [[error3, data3]] = [try someExpression() ?? otherexpression() ? true : false];
// used as an object value, terminated by comma or end of object
const { res: [error4, data4] } = { res: try someExpression() ?? otherexpression() ? true : false }

Changelog

0.2

  • Added the try-expression-proposal syntax to the parser basically copying the yield syntax.

0.1

  • Failed attempt that only partly worked.

TypeScript

GitHub Actions CI npm version Downloads OpenSSF Scorecard

TypeScript is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the playground, and stay up to date via our blog and Twitter account.

Find others who are using TypeScript at our community page.

Installing

For the latest stable version:

npm install -D typescript

For our nightly builds:

npm install -D typescript@next

Contribute

There are many ways to contribute to TypeScript.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Documentation

Roadmap

For details on our planned features and future direction, please refer to our roadmap.

About

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.9%
  • Other 0.1%