Skip to content

Class support

Latest
Compare
Choose a tag to compare
@ilyalesik ilyalesik released this 16 Feb 13:06
· 46 commits to master since this release

Implement transform class to declare class.

For example

// @flow

class URL<T> {
    urlStr: string;

    constructor(urlStr: string): URL {
        this.urlStr = urlStr;
    }
    toString(): string {
        return this.urlStr;
    }

    render() {}

    static compare(url1: URL, url2: URL): boolean {
        return url1 === url2;
    }
}

will be transformed to

// @flow
declare class URL<T> {
  urlStr: string,
  constructor(urlStr: string): URL,
  toString(): string,
  render(): any,
  static compare(url1: URL, url2: URL): boolean,
}