Assets 5

New Features:

type O = { a: number, b: string };

function fn(o: $ReadOnly<O>) {
  o.a = 42; // Error!
}
  • Allow read-only property initialization in constructors. Covariant properties
    are still read-only everywhere else in the class.
class X {
  +p: number;
  constructor(p: number) {
    this.p = p;
  }
}

Notable bug fixes:

  • Improves positioning for error messages involving exact objects. Notably, this
    bug caused error messages against React.Element to incorrectly point at
    library definitions instead of user code.

Misc:

  • Experimental implementation of find-all-references.
  • Enforces that exported class statics are annotated.
  • Improves typings for Node.js HTTP server listen() function.
  • Removes redundant information from some React error messages.

Parser:

  • Adds parser support for JSX fragments.
  • Various correctness changes to which identifiers error on reserved value
    and type names.
  • declare class with multiple extends is now a parse error.