https://github.com/ts-common/fun.ts/milestones?direction=asc&sort=title&state=open
Subset parser, no type analysis.
Use semicolon as separator.
const name = expression
- data
- string
`string`
. - number
45.6
- object
{ a: 56 }
- null
null
- undefined
undefined
- boolean
true
andfalse
- array
[ "something" ]
- function
a => expression
|a => { body }
. Yes, only one argument.
- string
- expressions:
exp.property
,exp[name]
,(exp)
,?:
,- arithmetic
+
,-
,*
,/
,%
,**
- compare
===
,!==
,<=
,>=
,>
,<
- logical
&&
,||
,!
- bitwise
|
,&
,^
,~
,<<
,>>
,>>>
- string interpolation,
typeof
{
const name = expression
...
return exp
}
- spread operators.
- destruction.
const { ["some"]: deleted, ...rest } = something
- No semicolons.
export const
export const name = expression
Only definitions and types. Separate declarations of type definitions and specifications.
- builders. Write-only objects with limitted scope. For example
{ const x = { p: 3 } x.p = somefunc() return x }
- integers,
| 0
. - nominal types,
instanceof
,class
etc. This is required for some existing types, such asDate
,Set
etc. Note:this
should be always be binded explicitly. For example, this code should give an error:As an option, we can prohibit non-lambda functionsclass A { x() { return this.y(); } y() { return 0; } } const a = new A(); const f = a.x; // error is here, because a.x can't be used without binding `this`.
class A { x = () => this.y() y = () => 0 } const a = new A(); const f = a.x; // ok
- generators, async/await?