Proposal: Optional Static Typing (Part 3)

Isiah Meadows isiahmeadows at
Thu Jan 11 15:01:15 UTC 2018

>From a quick read, I'm more in favor of something that's a little more
restricted to start, something like what Python has. Python has optional
static type annotations, but the Python interpreter just ignores them. They
are present purely for the purposes of tooling, and are silently ignored at

Conversely, PHP took a similar approach and initially also made it cosmetic
to start, only later taking advantage of *some* type annotations by adding
runtime behavior to some of the simpler ones (like primitives).

One of the reasons why I'd prefer a simpler approach to start is that
TypeScript and Flow, the two main implementations that add syntax, have a
*very* similar syntax, but have several nuances that would make a heavier
proposal much harder to accomplish:

- Flow has `?Foo` for optional types, TypeScript just uses unions.
- TypeScript has mapped/index types, where Flow uses special named types.
- Flow allows omitted parameter names in function types, TypeScript only
allows named parameters with implicit `any` types.
- Flow has exact types, TypeScript doesn't.
- Flow has `opaque type`, TypeScript only has `type`.
- Flow constrains with `T: Super`, TypeScript uses `T extends Super`.
- Flow has 3 different ways of importing bindings a module (depending on
what's being imported), TypeScript only has one.
- Flow has existential types, TypeScript doesn't.

Also, both TypeScript and Flow are still working out how to properly type
some of the more advanced JS (like variadic functions and auto-curried
functions), so their syntax is *still* not exactly stable enough I'd feel
comfortable encoding much into the spec. (They do have a stable core,

One other thing is that multiple active proposals could end up requiring TS
and/or Flow to substantially change parts of their syntax, including:

- Private [fields][1] and [methods][2] (stage 3 and 2 respectively, affects
- [First class protocols][3] (stage 1, affects both TS and Flow)
- [Typed literals][4] (stage 1, affects TS mostly)



Isiah Meadows
me at

Looking for web consulting? Or a new website?
Send me an email and we can get started.

On Thu, Jan 11, 2018 at 3:09 AM, Pranay Prakash < at> wrote:

> I'm still yet to read the entire proposal, but with a quick skim, it seems
> to me like this is essentially what Typescript or Flow offers you: i.e. an
> opt-in type system?
> I'm wondering if you have any good reasons to want there to be a
> standardised static type annotation syntax within ECMAScript instead of a
> "Bring Your Own Type Checker" system.
> If you do have some thoughts on this, you might also want to include that
> as a preface on your Github's README.You have a "Rationale" bit that seems
> to ignore the existence of these existing systems.
> Waiting to hear more thoughts on this :)
> On Thu, 11 Jan 2018 at 11:56 Brandon Andrews <
> warcraftthreeft at> wrote:
>> It's been a year and a half since my last post and I've made a number of
>> small changes and corrections over 2.5 years. The proposal is still on my
>> github at:
>> I've talked to a lot of people about it, but I haven't gotten much
>> criticism or suggested improvements. I'm a bit in over my head in trying to
>> flesh out all the details or all the nuanced syntax changes that a
>> championed proposal would be expected to do. That said I've been making
>> more changes lately to try to find edge cases and potential problems.
>> I've been jotting down issues here:
>> ecmascript-types/issues I closed a number of them recently as I made
>> changes.
>> If anyone has any comments on what I should expand, look into more, or
>> change I'm open to discussing them here or on github.
>> One issue in particular is this:
>> ecmascript-types/issues/15 It covers whether I should introduce a new
>> assignment operator to my proposal. Maybe there's another way to look at it
>> or a different solution. I need fresh eyes on the whole proposal really to
>> get a list of new issues to tackle this year.
>> I'm also not against having one or multiple people champion it and
>> working on it without me. (I haven't been able to dedicate time to read the
>> ECMAScript spec and really understanding the grammar fully so having
>> someone qualified to take over would help the proposal a lot).
>> Thanks for reading the proposal for anyone that has the time.
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list