Typescript: Please, make an option for syntax to write code without {}, such as python has, this is a dream for many people.

Created on 7 Oct 2016  路  6Comments  路  Source: microsoft/TypeScript

const request = require("request-promise")


interface User
  id: number
  username: string


class RegUser 

  constructor(public user: User)

  async reg(): Promise<boolean> 
    try 
      let user = JSON.stringify(this.user);
      await request('http://host.com/api/reg').post(user)
      return true
    catch(e)
      console.error(e)
    return false


let user: User = 
  id: 1
  username: 'root'


new RegUser(user).reg()
Out of Scope Suggestion

Most helpful comment

wut?!

All 6 comments

wut?!

The TypeScript Design Goals would totally prohibit this from even being considered.

If you want a language that is not a superset of JavaScript, then TypeScript is not for you.

What about parens for invokation? They are not needed as well (see F#). #noParents

If you want a language that is not a superset of JavaScript, then TypeScript is not for you.

Indeed. Many options listed at https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js

noParents 馃槅 come to my place, parents gone!

Was this page helpful?
0 / 5 - 0 ratings