Make tests spec compliant and avoid duplicate declarations in input files (#9522)

This commit is contained in:
Daniel Tschinder 2019-02-18 16:14:35 -08:00 committed by GitHub
parent 39af228ac4
commit a1ea765b95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
84 changed files with 4635 additions and 4583 deletions

View File

@ -4,7 +4,7 @@ function foo(l) {
); );
} }
function foo() { function foo2() {
return ( return (
1 && 2 1 && 2
) || 3; ) || 3;

View File

@ -4,7 +4,7 @@ function foo(l) {
} }
function foo() { function foo2() {
return ( return (
1 && 2 || 1 && 2 ||
3); 3);

View File

@ -1,5 +1,5 @@
class A implements B {} class A1 implements B {}
class A implements B, C {} class A2 implements B, C {}
declare class A implements B {} declare class A3 implements B {}
declare class A mixins B implements C {} declare class A4 mixins B implements C {}
declare class A implements B, C {} declare class A5 implements B, C {}

View File

@ -1,7 +1,7 @@
class A implements B {} class A1 implements B {}
class A implements B, C {} class A2 implements B, C {}
declare class A implements B {} declare class A3 implements B {}
declare class A mixins B implements C {} declare class A4 mixins B implements C {}
declare class A implements B, C {} declare class A5 implements B, C {}

View File

@ -1,9 +1,9 @@
interface A {} interface A1 {}
interface A extends B {} interface A2 extends B {}
interface A<T> extends B<T>, C<T> {} interface A3<T> extends B<T>, C<T> {}
interface A { foo: () => number; } interface A4 { foo: () => number; }
interface Dictionary { [index: string]: string; length: number; } interface Dictionary { [index: string]: string; length: number; }
class Foo implements Bar {} class Foo1 implements Bar {}
class Foo extends Bar implements Bat, Man<number> {} class Foo2 extends Bar implements Bat, Man<number> {}
class Foo extends class Bar implements Bat {} {} class Foo3 extends class Bar implements Bat {} {}
class Foo extends class Bar implements Bat {} implements Man {} class Foo4 extends class Bar implements Bat {} implements Man {}

View File

@ -1,7 +1,7 @@
interface A {} interface A1 {}
interface A extends B {} interface A2 extends B {}
interface A<T> extends B<T>, C<T> {} interface A3<T> extends B<T>, C<T> {}
interface A { interface A4 {
foo: () => number foo: () => number
} }
interface Dictionary { interface Dictionary {
@ -9,10 +9,10 @@ interface Dictionary {
[index: string]: string, [index: string]: string,
} }
class Foo implements Bar {} class Foo1 implements Bar {}
class Foo extends Bar implements Bat, Man<number> {} class Foo2 extends Bar implements Bat, Man<number> {}
class Foo extends class Bar implements Bat {} {} class Foo3 extends class Bar implements Bat {} {}
class Foo extends class Bar implements Bat {} implements Man {} class Foo4 extends class Bar implements Bat {} implements Man {}

View File

@ -12,6 +12,6 @@ function is_string(x): boolean %checks {
var f = (x: mixed): %checks => typeof x === "string"; var f = (x: mixed): %checks => typeof x === "string";
const foo = (x: mixed): boolean %checks => typeof x === "string"; const foo2 = (x: mixed): boolean %checks => typeof x === "string";
(x): %checks => x !== null; (x): %checks => x !== null;

View File

@ -12,6 +12,6 @@ function is_string(x): boolean %checks {
var f = (x: mixed): %checks => typeof x === "string"; var f = (x: mixed): %checks => typeof x === "string";
const foo = (x: mixed): boolean %checks => typeof x === "string"; const foo2 = (x: mixed): boolean %checks => typeof x === "string";
x: %checks => x !== null; x: %checks => x !== null;

View File

@ -1,2 +1,2 @@
function createElement(tagName: "div"): HTMLDivElement {} function createElement1(tagName: "div"): HTMLDivElement {}
function createElement(tagName: 'div'): HTMLDivElement {} function createElement2(tagName: 'div'): HTMLDivElement {}

View File

@ -1,3 +1,3 @@
function createElement(tagName: "div"): HTMLDivElement {} function createElement1(tagName: "div"): HTMLDivElement {}
function createElement(tagName: 'div'): HTMLDivElement {} function createElement2(tagName: 'div'): HTMLDivElement {}

View File

@ -1,130 +1,130 @@
function foo(numVal: any) {} function foo1(numVal: any) {}
function foo(numVal: number) {} function foo2(numVal: number) {}
function foo(numVal: number, strVal: string) {} function foo3(numVal: number, strVal: string) {}
function foo(numVal: number, untypedVal) {} function foo4(numVal: number, untypedVal) {}
function foo(untypedVal, numVal: number) {} function foo5(untypedVal, numVal: number) {}
function foo(nullableNum: ?number) {} function foo6(nullableNum: ?number) {}
function foo(callback: () => void) {} function foo7(callback: () => void) {}
function foo(callback: () => number) {} function foo8(callback: () => number) {}
function foo(callback: (_: bool) => number) {} function foo9(callback: (_: bool) => number) {}
function foo(callback: (_1: bool, _2: string) => number) {} function foo10(callback: (_1: bool, _2: string) => number) {}
function foo(callback: (_1: bool, ...foo: Array<number>) => number) {} function foo11(callback: (_1: bool, ...foo: Array<number>) => number) {}
function foo(): number{} function foo12(): number{}
function foo():() => void {} function foo13():() => void {}
function foo():(_:bool) => number{} function foo14():(_:bool) => number{}
function foo():(_?:bool) => number{} function foo15():(_?:bool) => number{}
function foo(): {} {} function foo16(): {} {}
function foo<T>() {} function foo17<T>() {}
function foo<T,S>() {} function foo18<T,S>() {}
function foo<T: F>() {} function foo19<T: F>() {}
a = function<T,S>() {}; a1 = function<T,S>() {};
a = { set fooProp(value: number) {} }; a2 = { set fooProp(value: number) {} };
a = { set fooProp(value: number): void {} }; a3 = { set fooProp(value: number): void {} };
a = { get fooProp():number{} }; a4 = { get fooProp():number{} };
a = { id<T>(x: T): T {} }; a5 = { id<T>(x: T): T {} };
a = { *id<T>(x: T): T {} }; a6 = { *id<T>(x: T): T {} };
a = { async id<T>(x: T): T {} }; a7 = { async id<T>(x: T): T {} };
a = { 123<T>(x: T): T {} }; a8 = { 123<T>(x: T): T {} };
class Foo { class Foo1 {
set fooProp(value: number) {} set fooProp(value: number) {}
} }
class Foo { class Foo2 {
set fooProp(value: number): void {} set fooProp(value: number): void {}
} }
class Foo { class Foo3 {
get fooProp(): number {} get fooProp(): number {}
} }
var numVal: number; var numVal1: number;
var numVal: empty; var numVal2: empty;
var numVal: mixed; var numVal3: mixed;
var numVal: number = otherNumVal; var numVal4: number = otherNumVal;
var a: { numVal: number }; var a1: { numVal: number };
var a: { numVal: number; }; var a2: { numVal: number; };
var a: { numVal: number; [indexer: string]: number }; var a3: { numVal: number; [indexer: string]: number };
var a: ?{ numVal: number }; var a4: ?{ numVal: number };
var a: { numVal: number; strVal: string } var a5: { numVal: number; strVal: string }
var a: { subObj: {strVal: string} } var a6: { subObj: {strVal: string} }
var a: { subObj: ?{strVal: string} } var a7: { subObj: ?{strVal: string} }
var a: { param1: number; param2: string } var a8: { param1: number; param2: string }
var a: { param1: number; param2?: string } var a9: { param1: number; param2?: string }
var a: { [a: number]: string; [b: number]: string; }; var a10: { [a: number]: string; [b: number]: string; };
var a: { add(x: number, ...y: Array<string>): void }; var a11: { add(x: number, ...y: Array<string>): void };
var a: { subtract: (x: number, ...y: Array<string>) => void }; var a12: { subtract: (x: number, ...y: Array<string>) => void };
var a: { id<T>(x: T): T; }; var a13: { id<T>(x: T): T; };
var a:Array<number> = [1, 2, 3] var a14:Array<number> = [1, 2, 3]
a = class Foo<T> {} a13 = class Foo<T> {}
a = class Foo<T> extends Bar<T> {} a14 = class Foo<T> extends Bar<T> {}
class Foo<T> {} class Foo4<T> {}
class Foo<T> extends Bar<T> {} class Foo5<T> extends Bar<T> {}
class Foo<T> extends mixin(Bar) {} class Foo6<T> extends mixin(Bar) {}
class Foo<T> { class Foo7<T> {
bar<U>():number { return 42; } bar<U>():number { return 42; }
} }
class Foo { class Foo8 {
"bar"<T>() {} "bar"<T>() {}
} }
function foo(requiredParam, optParam?) {} function foo20(requiredParam, optParam?) {}
class Foo { class Foo9 {
prop1: string; prop1: string;
prop2: number; prop2: number;
} }
class Foo { class Foo10 {
static prop1: string; static prop1: string;
prop2: number; prop2: number;
} }
class Foo { class Foo11 {
#prop1: string; #prop1: string;
prop2: number; prop2: number;
} }
var x: number | string = 4; var x1: number | string = 4;
class Array { concat(items:number | string) {}; } class Array { concat(items:number | string) {}; }
var x: () => number | () => string = fn; var x2: () => number | () => string = fn;
var x: typeof Y = Y; var x3: typeof Y = Y;
var x: typeof Y | number = Y; var x4: typeof Y | number = Y;
var {x}: {x: string; } = { x: "hello" }; var {x5}: {x5: string; } = { x5: "hello" };
var {x}: {x: string } = { x: "hello" }; var {x6}: {x6: string } = { x6: "hello" };
var [x]: Array<string> = [ "hello" ]; var [x7]: Array<string> = [ "hello" ];
function foo({x}: { x: string; }) {} function foo21({x}: { x: string; }) {}
function foo([x]: Array<string>) {} function foo22([x]: Array<string>) {}
function foo(...rest: Array<number>) {} function foo23(...rest: Array<number>) {}
(function (...rest: Array<number>) {}); (function (...rest: Array<number>) {});
((...rest: Array<number>) => rest); ((...rest: Array<number>) => rest);
var a: Map<string, Array<string> > var a15: Map<string, Array<string> >
var a: Map<string, Array<string>> var a16: Map<string, Array<string>>
var a: number[] var a17: number[]
var a: ?string[] var a18: ?string[]
var a: Promise<bool>[] var a19: Promise<bool>[]
var a:(...rest:Array<number>) => number var a20:(...rest:Array<number>) => number
var identity: <T>(x: T) => T var identity1: <T>(x: T) => T
var identity: <T>(x: T, ...y:T[]) => T var identity2: <T>(x: T, ...y:T[]) => T
import type foo from "bar"; import type foo24 from "bar";
import type { foo, bar } from "baz"; import type { foo25, bar1 } from "baz";
import type { foo as bar } from "baz"; import type { foo as bar2 } from "baz";
import type from "foo"; import type from "foo";
import type, { foo } from "bar"; import type2, { foo26 } from "bar";
import typeof * as namespace from "bar"; import typeof * as namespace from "bar";
import { type Foo } from "bar"; import { type Foo12 } from "bar";
import { typeof Foo } from "bar"; import { typeof Foo13 } from "bar";
import { type Foo as Bar } from "bar"; import { type Foo as Bar1 } from "bar";
import { typeof Foo as Bar } from "bar"; import { typeof Foo as Bar2 } from "bar";
export type { foo }; export type { foo };
export type { bar } from "bar"; export type { bar } from "bar";
export interface baz { p: number } export interface baz { p: number }
export interface qux<T> { p: T } export interface qux<T> { p: T }
var a: ?Array<?string>; var a21: ?Array<?string>;
var a: {| numVal: number |}; var a22: {| numVal: number |};
var a: {| numVal: number; |}; var a23: {| numVal: number; |};
var a: {| numVal: number; [indexer: string]: number |}; var a24: {| numVal: number; [indexer: string]: number |};
var a: ?{| numVal: number |}; var a25: ?{| numVal: number |};
var a: {| numVal: number; strVal: string |} var a26: {| numVal: number; strVal: string |}
var a: {| subObj: {strVal: string} |} var a27: {| subObj: {strVal: string} |}
var a: {| subObj: ?{strVal: string} |} var a28: {| subObj: ?{strVal: string} |}
var a: {| param1: number; param2: string |} var a29: {| param1: number; param2: string |}
var a: {| param1: number; param2?: string |} var a30: {| param1: number; param2?: string |}
var a: {| [a: number]: string; [b: number]: string; |}; var a31: {| [a: number]: string; [b: number]: string; |};
var a: {| add(x: number, ...y: Array<string>): void |}; var a32: {| add(x: number, ...y: Array<string>): void |};
var a: {| subtract: (x: number, ...y: Array<string>) => void |}; var a33: {| subtract: (x: number, ...y: Array<string>) => void |};
var a: {| id<T>(x: T): T; |}; var a34: {| id<T>(x: T): T; |};
function foo(numVal: number = 2) {} function foo27(numVal: number = 2) {}
function foo(numVal?: number = 2) {} function foo28(numVal?: number = 2) {}
export type * from "foo"; export type * from "foo";

View File

@ -1,236 +1,236 @@
function foo(numVal: any) {} function foo1(numVal: any) {}
function foo(numVal: number) {} function foo2(numVal: number) {}
function foo(numVal: number, strVal: string) {} function foo3(numVal: number, strVal: string) {}
function foo(numVal: number, untypedVal) {} function foo4(numVal: number, untypedVal) {}
function foo(untypedVal, numVal: number) {} function foo5(untypedVal, numVal: number) {}
function foo(nullableNum: ?number) {} function foo6(nullableNum: ?number) {}
function foo(callback: () => void) {} function foo7(callback: () => void) {}
function foo(callback: () => number) {} function foo8(callback: () => number) {}
function foo(callback: (_: boolean) => number) {} function foo9(callback: (_: boolean) => number) {}
function foo(callback: (_1: boolean, _2: string) => number) {} function foo10(callback: (_1: boolean, _2: string) => number) {}
function foo(callback: (_1: boolean, ...foo: Array<number>) => number) {} function foo11(callback: (_1: boolean, ...foo: Array<number>) => number) {}
function foo(): number {} function foo12(): number {}
function foo(): () => void {} function foo13(): () => void {}
function foo(): (_: boolean) => number {} function foo14(): (_: boolean) => number {}
function foo(): (_?: boolean) => number {} function foo15(): (_?: boolean) => number {}
function foo(): {} {} function foo16(): {} {}
function foo<T>() {} function foo17<T>() {}
function foo<T, S>() {} function foo18<T, S>() {}
function foo<T: F>() {} function foo19<T: F>() {}
a = function <T, S>() {}; a1 = function <T, S>() {};
a = { a2 = {
set fooProp(value: number) {} set fooProp(value: number) {}
}; };
a = { a3 = {
set fooProp(value: number): void {} set fooProp(value: number): void {}
}; };
a = { a4 = {
get fooProp(): number {} get fooProp(): number {}
}; };
a = { a5 = {
id<T>(x: T): T {} id<T>(x: T): T {}
}; };
a = { a6 = {
*id<T>(x: T): T {} *id<T>(x: T): T {}
}; };
a = { a7 = {
async id<T>(x: T): T {} async id<T>(x: T): T {}
}; };
a = { a8 = {
123<T>(x: T): T {} 123<T>(x: T): T {}
}; };
class Foo { class Foo1 {
set fooProp(value: number) {} set fooProp(value: number) {}
} }
class Foo { class Foo2 {
set fooProp(value: number): void {} set fooProp(value: number): void {}
} }
class Foo { class Foo3 {
get fooProp(): number {} get fooProp(): number {}
} }
var numVal: number; var numVal1: number;
var numVal: empty; var numVal2: empty;
var numVal: mixed; var numVal3: mixed;
var numVal: number = otherNumVal; var numVal4: number = otherNumVal;
var a: { var a1: {
numVal: number numVal: number
}; };
var a: { var a2: {
numVal: number numVal: number
}; };
var a: { var a3: {
numVal: number, numVal: number,
[indexer: string]: number, [indexer: string]: number,
}; };
var a: ?{ var a4: ?{
numVal: number numVal: number
}; };
var a: { var a5: {
numVal: number, numVal: number,
strVal: string, strVal: string,
}; };
var a: { var a6: {
subObj: { subObj: {
strVal: string strVal: string
} }
}; };
var a: { var a7: {
subObj: ?{ subObj: ?{
strVal: string strVal: string
} }
}; };
var a: { var a8: {
param1: number, param1: number,
param2: string, param2: string,
}; };
var a: { var a9: {
param1: number, param1: number,
param2?: string, param2?: string,
}; };
var a: { var a10: {
[a: number]: string, [a: number]: string,
[b: number]: string, [b: number]: string,
}; };
var a: { var a11: {
add(x: number, ...y: Array<string>): void add(x: number, ...y: Array<string>): void
}; };
var a: { var a12: {
subtract: (x: number, ...y: Array<string>) => void subtract: (x: number, ...y: Array<string>) => void
}; };
var a: { var a13: {
id<T>(x: T): T id<T>(x: T): T
}; };
var a: Array<number> = [1, 2, 3]; var a14: Array<number> = [1, 2, 3];
a = class Foo<T> {}; a13 = class Foo<T> {};
a = class Foo<T> extends Bar<T> {}; a14 = class Foo<T> extends Bar<T> {};
class Foo<T> {} class Foo4<T> {}
class Foo<T> extends Bar<T> {} class Foo5<T> extends Bar<T> {}
class Foo<T> extends mixin(Bar) {} class Foo6<T> extends mixin(Bar) {}
class Foo<T> { class Foo7<T> {
bar<U>(): number { bar<U>(): number {
return 42; return 42;
} }
} }
class Foo { class Foo8 {
"bar"<T>() {} "bar"<T>() {}
} }
function foo(requiredParam, optParam?) {} function foo20(requiredParam, optParam?) {}
class Foo { class Foo9 {
prop1: string; prop1: string;
prop2: number; prop2: number;
} }
class Foo { class Foo10 {
static prop1: string; static prop1: string;
prop2: number; prop2: number;
} }
class Foo { class Foo11 {
#prop1: string; #prop1: string;
prop2: number; prop2: number;
} }
var x: number | string = 4; var x1: number | string = 4;
class Array { class Array {
concat(items: number | string) {} concat(items: number | string) {}
} }
var x: () => number | (() => string) = fn; var x2: () => number | (() => string) = fn;
var x: typeof Y = Y; var x3: typeof Y = Y;
var x: typeof Y | number = Y; var x4: typeof Y | number = Y;
var { var {
x x5
}: { }: {
x: string x5: string
} = { } = {
x: "hello" x5: "hello"
}; };
var { var {
x x6
}: { }: {
x: string x6: string
} = { } = {
x: "hello" x6: "hello"
}; };
var [x]: Array<string> = ["hello"]; var [x7]: Array<string> = ["hello"];
function foo({ function foo21({
x x
}: { }: {
x: string x: string
}) {} }) {}
function foo([x]: Array<string>) {} function foo22([x]: Array<string>) {}
function foo(...rest: Array<number>) {} function foo23(...rest: Array<number>) {}
(function (...rest: Array<number>) {}); (function (...rest: Array<number>) {});
(...rest: Array<number>) => rest; (...rest: Array<number>) => rest;
var a: Map<string, Array<string>>; var a15: Map<string, Array<string>>;
var a: Map<string, Array<string>>; var a16: Map<string, Array<string>>;
var a: number[]; var a17: number[];
var a: ?string[]; var a18: ?string[];
var a: Promise<boolean>[]; var a19: Promise<boolean>[];
var a: (...rest: Array<number>) => number; var a20: (...rest: Array<number>) => number;
var identity: <T>(x: T) => T; var identity1: <T>(x: T) => T;
var identity: <T>(x: T, ...y: T[]) => T; var identity2: <T>(x: T, ...y: T[]) => T;
import type foo from "bar"; import type foo24 from "bar";
import type { foo, bar } from "baz"; import type { foo25, bar1 } from "baz";
import type { foo as bar } from "baz"; import type { foo as bar2 } from "baz";
import type from "foo"; import type from "foo";
import type, { foo } from "bar"; import type2, { foo26 } from "bar";
import typeof * as namespace from "bar"; import typeof * as namespace from "bar";
import { type Foo } from "bar"; import { type Foo12 } from "bar";
import { typeof Foo } from "bar"; import { typeof Foo13 } from "bar";
import { type Foo as Bar } from "bar"; import { type Foo as Bar1 } from "bar";
import { typeof Foo as Bar } from "bar"; import { typeof Foo as Bar2 } from "bar";
export type { foo }; export type { foo };
export type { bar } from "bar"; export type { bar } from "bar";
export interface baz { export interface baz {
@ -239,58 +239,58 @@ export interface baz {
export interface qux<T> { export interface qux<T> {
p: T p: T
} }
var a: ?Array<?string>; var a21: ?Array<?string>;
var a: {| var a22: {|
numVal: number numVal: number
|}; |};
var a: {| var a23: {|
numVal: number numVal: number
|}; |};
var a: {| var a24: {|
numVal: number, numVal: number,
[indexer: string]: number, [indexer: string]: number,
|}; |};
var a: ?{| var a25: ?{|
numVal: number numVal: number
|}; |};
var a: {| var a26: {|
numVal: number, numVal: number,
strVal: string, strVal: string,
|}; |};
var a: {| var a27: {|
subObj: { subObj: {
strVal: string strVal: string
} }
|}; |};
var a: {| var a28: {|
subObj: ?{ subObj: ?{
strVal: string strVal: string
} }
|}; |};
var a: {| var a29: {|
param1: number, param1: number,
param2: string, param2: string,
|}; |};
var a: {| var a30: {|
param1: number, param1: number,
param2?: string, param2?: string,
|}; |};
var a: {| var a31: {|
[a: number]: string, [a: number]: string,
[b: number]: string, [b: number]: string,
|}; |};
var a: {| var a32: {|
add(x: number, ...y: Array<string>): void add(x: number, ...y: Array<string>): void
|}; |};
var a: {| var a33: {|
subtract: (x: number, ...y: Array<string>) => void subtract: (x: number, ...y: Array<string>) => void
|}; |};
var a: {| var a34: {|
id<T>(x: T): T id<T>(x: T): T
|}; |};
function foo(numVal: number = 2) {} function foo27(numVal: number = 2) {}
function foo(numVal?: number = 2) {} function foo28(numVal?: number = 2) {}
export type * from "foo"; export type * from "foo";

View File

@ -1,21 +1,21 @@
type A<T = string> = T; type A1<T = string> = T;
type A<T = *> = T; type A2<T = *> = T;
type A<T: ?string = string> = T; type A3<T: ?string = string> = T;
type A<S, T: ?string = string> = T; type A4<S, T: ?string = string> = T;
type A<S = number, T: ?string = string> = T; type A5<S = number, T: ?string = string> = T;
class A<T = string> {} class A6<T = string> {}
class A<T: ?string = string> {} class A7<T: ?string = string> {}
class A<S, T: ?string = string> {} class A8<S, T: ?string = string> {}
class A<S = number, T: ?string = string> {} class A9<S = number, T: ?string = string> {}
(class A<T = string> {}); (class A10<T = string> {});
(class A<T: ?string = string> {}); (class A11<T: ?string = string> {});
(class A<S, T: ?string = string> {}); (class A12<S, T: ?string = string> {});
(class A<S = number, T: ?string = string> {}); (class A13<S = number, T: ?string = string> {});
declare class A<T = string> {} declare class A14<T = string> {}
declare class A<T: ?string = string> {} declare class A15<T: ?string = string> {}
declare class A<S, T: ?string = string> {} declare class A16<S, T: ?string = string> {}
declare class A<S = number, T: ?string = string> {} declare class A17<S = number, T: ?string = string> {}
interface A<T = string> {} interface A18<T = string> {}
interface A<T: ?string = string> {} interface A19<T: ?string = string> {}
interface A<S, T: ?string = string> {} interface A20<S, T: ?string = string> {}
interface A<S = number, T: ?string = string> {} interface A21<S = number, T: ?string = string> {}

View File

@ -1,30 +1,30 @@
type A<T = string> = T; type A1<T = string> = T;
type A<T = *> = T; type A2<T = *> = T;
type A<T: ?string = string> = T; type A3<T: ?string = string> = T;
type A<S, T: ?string = string> = T; type A4<S, T: ?string = string> = T;
type A<S = number, T: ?string = string> = T; type A5<S = number, T: ?string = string> = T;
class A<T = string> {} class A6<T = string> {}
class A<T: ?string = string> {} class A7<T: ?string = string> {}
class A<S, T: ?string = string> {} class A8<S, T: ?string = string> {}
class A<S = number, T: ?string = string> {} class A9<S = number, T: ?string = string> {}
(class A<T = string> {}); (class A10<T = string> {});
(class A<T: ?string = string> {}); (class A11<T: ?string = string> {});
(class A<S, T: ?string = string> {}); (class A12<S, T: ?string = string> {});
(class A<S = number, T: ?string = string> {}); (class A13<S = number, T: ?string = string> {});
declare class A<T = string> {} declare class A14<T = string> {}
declare class A<T: ?string = string> {} declare class A15<T: ?string = string> {}
declare class A<S, T: ?string = string> {} declare class A16<S, T: ?string = string> {}
declare class A<S = number, T: ?string = string> {} declare class A17<S = number, T: ?string = string> {}
interface A<T = string> {} interface A18<T = string> {}
interface A<T: ?string = string> {} interface A19<T: ?string = string> {}
interface A<S, T: ?string = string> {} interface A20<S, T: ?string = string> {}
interface A<S = number, T: ?string = string> {} interface A21<S = number, T: ?string = string> {}

View File

@ -4,15 +4,15 @@ function t2({responseText}) {
} }
function t3([a, b]) { function t3([a, b]) {
} }
var [i, j, k] = array; var [i1, j1, k1] = array;
var { var {
i, i2,
j, j2,
k k2
} = obj; } = obj;
let {i, j, k} = obj; let {i3, j3, k3} = obj;
const {i, j, k} = obj; const {i4, j4, k4} = obj;
var { value } = obj; var { value1 } = obj;
var { var {
value value2
} = obj; } = obj;

View File

@ -8,25 +8,25 @@ function t2({
function t3([a, b]) {} function t3([a, b]) {}
var [i, j, k] = array; var [i1, j1, k1] = array;
var { var {
i, i2,
j, j2,
k k2
} = obj; } = obj;
let { let {
i, i3,
j, j3,
k k3
} = obj; } = obj;
const { const {
i, i4,
j, j4,
k k4
} = obj; } = obj;
var { var {
value value1
} = obj; } = obj;
var { var {
value value2
} = obj; } = obj;

View File

@ -1,5 +1,5 @@
import foo from "foo"; import foo1 from "foo";
import * as foo from "foo"; import * as foo2 from "foo";
import ok, { import ok, {
foo as bar, foo as bar,
test as testing, test as testing,

View File

@ -1,3 +1,3 @@
import foo from "foo"; import foo1 from "foo";
import * as foo from "foo"; import * as foo2 from "foo";
import ok, { foo as bar, test as testing, logging } from "foo"; import ok, { foo as bar, test as testing, logging } from "foo";

View File

@ -1,8 +1,8 @@
import "foo"; import "foo";
import {foo} from "foo"; import {foo} from "foo";
import {foo as bar} from "foo"; import {foo as bar1} from "foo";
import { import {
foo as bar, foo as bar2,
test as testing, test as testing,
logging logging
} from "foo"; } from "foo";

View File

@ -1,4 +1,4 @@
import "foo"; import "foo";
import { foo } from "foo"; import { foo } from "foo";
import { foo as bar } from "foo"; import { foo as bar1 } from "foo";
import { foo as bar, test as testing, logging } from "foo"; import { foo as bar2, test as testing, logging } from "foo";

View File

@ -1,5 +1,5 @@
var [a, b, ...rest] = array; var [a1, b1, ...rest1] = array;
const [a, b, ...rest] = array; const [a2, b2, ...rest2] = array;
function a([a, b, ...rest]) { function a([a1, b1, ...rest1]) {
} }
([a, b, ...rest]) => { }; ([a1, b1, ...rest1]) => { };

View File

@ -1,6 +1,6 @@
var [a, b, ...rest] = array; var [a1, b1, ...rest1] = array;
const [a, b, ...rest] = array; const [a2, b2, ...rest2] = array;
function a([a, b, ...rest]) {} function a([a1, b1, ...rest1]) {}
([a, b, ...rest]) => {}; ([a1, b1, ...rest1]) => {};

View File

@ -1,22 +1,22 @@
class A extends (() => {}) {} class A1 extends (() => {}) {}
class A extends (B = C) {} class A2 extends (B = C) {}
class A extends (B || C) {} class A3 extends (B || C) {}
class A extends (B + C) {} class A4 extends (B + C) {}
class A extends B() {} class A5 extends B() {}
class A extends class {} {} class A6 extends class {} {}
class A extends (B ? C : D) {} class A7 extends (B ? C : D) {}
class A extends (new B()) {} class A8 extends (new B()) {}
class A extends (B, C) {} class A9 extends (B, C) {}
class A extends ({}) {} class A10 extends ({}) {}
class A extends B.C {} class A11 extends B.C {}
class A extends function() {} {} class A12 extends function() {} {}
class A extends (void B) {} class A13 extends (void B) {}
class A extends (++B) {} class A14 extends (++B) {}
async function f() { async function f1() {
class A extends (await C) {} class A15 extends (await C) {}
} }
function* f() { function* f2() {
class A extends (yield 1) {} class A16 extends (yield 1) {}
} }

View File

@ -1,35 +1,35 @@
class A extends (() => {}) {} class A1 extends (() => {}) {}
class A extends (B = C) {} class A2 extends (B = C) {}
class A extends (B || C) {} class A3 extends (B || C) {}
class A extends (B + C) {} class A4 extends (B + C) {}
class A extends B() {} class A5 extends B() {}
class A extends class {} {} class A6 extends class {} {}
class A extends (B ? C : D) {} class A7 extends (B ? C : D) {}
class A extends (new B()) {} class A8 extends (new B()) {}
class A extends (B, C) {} class A9 extends (B, C) {}
class A extends {} {} class A10 extends {} {}
class A extends B.C {} class A11 extends B.C {}
class A extends function () {} {} class A12 extends function () {} {}
class A extends (void B) {} class A13 extends (void B) {}
class A extends (++B) {} class A14 extends (++B) {}
async function f() { async function f1() {
class A extends (await C) {} class A15 extends (await C) {}
} }
function* f() { function* f2() {
class A extends (yield 1) {} class A16 extends (yield 1) {}
} }

View File

@ -1,10 +1,10 @@
function foo() { function foo1() {
return ( // foobar return ( // foobar
"bar" "bar"
); );
} }
function foo() { function foo2() {
return ( return (
// foobar // foobar
"bar" "bar"

View File

@ -1,10 +1,10 @@
function foo() { function foo1() {
return (// foobar return (// foobar
"bar" "bar"
); );
} }
function foo() { function foo2() {
return (// foobar return (// foobar
"bar" "bar"
); );

View File

@ -1,2 +1,2 @@
class Foo {} class Foo {}
class Foo extends Bar {} class Foo2 extends Bar {}

View File

@ -1,3 +1,3 @@
class Foo {} class Foo {}
class Foo extends Bar {} class Foo2 extends Bar {}

View File

@ -31,14 +31,14 @@ class Foo {
} }
@foo @foo
export default class Foo { export default class Foo2 {
bar() { bar() {
class Baz {} class Baz {}
} }
} }
@foo @foo
export class Foo { export class Foo3 {
bar() { bar() {
class Baz {} class Baz {}
} }

View File

@ -33,14 +33,14 @@ class Foo {
} }
export default @foo export default @foo
class Foo { class Foo2 {
bar() { bar() {
class Baz {} class Baz {}
} }
} }
export @foo export @foo
class Foo { class Foo3 {
bar() { bar() {
class Baz {} class Baz {}
} }

View File

@ -1,23 +1,23 @@
function foo(bar = "bar") {} function foo1(bar = "bar") {}
function foo(bar = "bar", ...items) {} function foo2(bar = "bar", ...items) {}
function foo(...items) {} function foo3(...items) {}
function* foo() {} function* foo4() {}
function foo() {} function foo5() {}
async function foo() {} async function foo6() {}
var foo = function* foo() {}; var foo7 = function* foo7() {};
var foo = function foo() {}; var foo8 = function foo8() {};
var foo = async function foo() {}; var foo9 = async function foo9() {};
var foo = function* () {}; var foo10 = function* () {};
var foo = function () {}; var foo11 = function () {};
var foo = async function () {}; var foo12 = async function () {};

View File

@ -1,23 +1,23 @@
function foo(bar = "bar") {} function foo1(bar = "bar") {}
function foo(bar = "bar", ...items) {} function foo2(bar = "bar", ...items) {}
function foo(...items) {} function foo3(...items) {}
function* foo() {} function* foo4() {}
function foo() {} function foo5() {}
async function foo() {} async function foo6() {}
var foo = function* foo() {}; var foo7 = function* foo7() {};
var foo = function foo() {}; var foo8 = function foo8() {};
var foo = async function foo() {}; var foo9 = async function foo9() {};
var foo = function* () {}; var foo10 = function* () {};
var foo = function () {}; var foo11 = function () {};
var foo = async function () {}; var foo12 = async function () {};

View File

@ -1,9 +1,9 @@
import "foo"; import "foo";
import foo from "foo"; import foo1 from "foo";
import { default as foo } from "foo"; import { default as foo2 } from "foo";
import * as foo from "foo"; import * as foo3 from "foo";
import foo, { baz as xyz } from "foo"; import foo4, { baz as xyz1 } from "foo";
import { bar } from "foo"; import { bar1 } from "foo";
import { bar, baz } from "foo"; import { bar2, baz1 } from "foo";
import { bar as baz } from "foo"; import { bar as baz2 } from "foo";
import { bar as baz, xyz } from "foo"; import { bar as baz3, xyz2 } from "foo";

View File

@ -1,9 +1,9 @@
import "foo"; import "foo";
import foo from "foo"; import foo1 from "foo";
import { default as foo } from "foo"; import { default as foo2 } from "foo";
import * as foo from "foo"; import * as foo3 from "foo";
import foo, { baz as xyz } from "foo"; import foo4, { baz as xyz1 } from "foo";
import { bar } from "foo"; import { bar1 } from "foo";
import { bar, baz } from "foo"; import { bar2, baz1 } from "foo";
import { bar as baz } from "foo"; import { bar as baz2 } from "foo";
import { bar as baz, xyz } from "foo"; import { bar as baz3, xyz2 } from "foo";

View File

@ -1,4 +1,4 @@
function foo() { function foo1() {
return; return;
} }
@ -6,10 +6,10 @@ function bar() {
return "foo"; return "foo";
} }
function foo() { function foo2() {
return 1, "foo"; return 1, "foo";
} }
() => { return /a/; } () => { return /a/; }
function foo() { return /a/; } function foo3() { return /a/; }

View File

@ -1,4 +1,4 @@
function foo() { function foo1() {
return; return;
} }
@ -6,7 +6,7 @@ function bar() {
return "foo"; return "foo";
} }
function foo() { function foo2() {
return 1, "foo"; return 1, "foo";
} }
@ -14,6 +14,6 @@ function foo() {
return /a/; return /a/;
}; };
function foo() { function foo3() {
return /a/; return /a/;
} }

View File

@ -1,13 +1,13 @@
let foo; let foo1;
var foo; var foo2;
let foo = "foo"; let foo3 = "foo";
var foo = "bar"; var foo4 = "bar";
const foo = "foo"; const foo5 = "foo";
let foo, bar = "bar"; let foo6, bar1 = "bar";
var foo, bar = "bar"; var foo7, bar2 = "bar";
let foo = "foo", bar = "bar"; let foo8 = "foo", bar3 = "bar";
var foo = "foo", bar = "bar"; var foo9 = "foo", bar4 = "bar";
const foo = "foo", bar = "bar"; const foo10 = "foo", bar5 = "bar";

View File

@ -1,15 +1,15 @@
let foo; let foo1;
var foo; var foo2;
let foo = "foo"; let foo3 = "foo";
var foo = "bar"; var foo4 = "bar";
const foo = "foo"; const foo5 = "foo";
let foo, let foo6,
bar = "bar"; bar1 = "bar";
var foo, var foo7,
bar = "bar"; bar2 = "bar";
let foo = "foo", let foo8 = "foo",
bar = "bar"; bar3 = "bar";
var foo = "foo", var foo9 = "foo",
bar = "bar"; bar4 = "bar";
const foo = "foo", const foo10 = "foo",
bar = "bar"; bar5 = "bar";

View File

@ -1,7 +1,7 @@
abstract class C {} abstract class C1 {}
declare abstract class C {} declare abstract class C2 {}
export abstract class C {} export abstract class C3 {}
// `export abstract class { }` is not valid. // `export abstract class { }` is not valid.
export default abstract class { } export default abstract class { }
export default abstract class C { } export default abstract class C4 { }
// `abstract class` is not valid as an expression. // `abstract class` is not valid as an expression.

View File

@ -1,8 +1,8 @@
abstract class C {} abstract class C1 {}
declare abstract class C {} declare abstract class C2 {}
export abstract class C {} // `export abstract class { }` is not valid. export abstract class C3 {} // `export abstract class { }` is not valid.
export default abstract class {} export default abstract class {}
export default abstract class C {} // `abstract class` is not valid as an expression. export default abstract class C4 {} // `abstract class` is not valid as an expression.

View File

@ -1,2 +1,2 @@
let x: true; let x: true;
let x: false; let x2: false;

View File

@ -1,2 +1,2 @@
let x: true; let x: true;
let x: false; let x2: false;

View File

@ -1,4 +1,4 @@
let map: { [P in string]: number }; let map1: { [P in string]: number };
let map: { readonly [P in string]?: number }; let map2: { readonly [P in string]?: number };
let map: { +readonly [P in string]+?: number }; let map3: { +readonly [P in string]+?: number };
let map: { -readonly [P in string]-?: number }; let map4: { -readonly [P in string]-?: number };

View File

@ -1,4 +1,4 @@
let map: { [P in string]: number }; let map1: { [P in string]: number };
let map: { readonly [P in string]?: number }; let map2: { readonly [P in string]?: number };
let map: { +readonly [P in string]+?: number }; let map3: { +readonly [P in string]+?: number };
let map: { -readonly [P in string]-?: number }; let map4: { -readonly [P in string]-?: number };

View File

@ -1 +0,0 @@
function null() { }

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:9)"
}

View File

@ -1 +0,0 @@
function true() { }

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:9)"
}

View File

@ -1 +0,0 @@
function false() { }

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:9)"
}

View File

@ -1 +0,0 @@
function if() { }

View File

@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:9)"
}

View File

@ -3,7 +3,7 @@ class Foo {
y y
} }
class Foo { class Foo2 {
p p
[m] () {} [m] () {}
} }

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 52, "end": 53,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -15,7 +15,7 @@
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 52, "end": 53,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -152,7 +152,7 @@
{ {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 23, "start": 23,
"end": 52, "end": 53,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
@ -166,7 +166,7 @@
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 29, "start": 29,
"end": 32, "end": 33,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
@ -174,21 +174,21 @@
}, },
"end": { "end": {
"line": 6, "line": 6,
"column": 9 "column": 10
}, },
"identifierName": "Foo" "identifierName": "Foo2"
}, },
"name": "Foo" "name": "Foo2"
}, },
"superClass": null, "superClass": null,
"body": { "body": {
"type": "ClassBody", "type": "ClassBody",
"start": 33, "start": 34,
"end": 52, "end": 53,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
"column": 10 "column": 11
}, },
"end": { "end": {
"line": 9, "line": 9,
@ -198,8 +198,8 @@
"body": [ "body": [
{ {
"type": "ClassProperty", "type": "ClassProperty",
"start": 37, "start": 38,
"end": 38, "end": 39,
"loc": { "loc": {
"start": { "start": {
"line": 7, "line": 7,
@ -213,8 +213,8 @@
"static": false, "static": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 37, "start": 38,
"end": 38, "end": 39,
"loc": { "loc": {
"start": { "start": {
"line": 7, "line": 7,
@ -233,8 +233,8 @@
}, },
{ {
"type": "ClassMethod", "type": "ClassMethod",
"start": 41, "start": 42,
"end": 50, "end": 51,
"loc": { "loc": {
"start": { "start": {
"line": 8, "line": 8,
@ -249,8 +249,8 @@
"computed": true, "computed": true,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 42, "start": 43,
"end": 43, "end": 44,
"loc": { "loc": {
"start": { "start": {
"line": 8, "line": 8,
@ -271,8 +271,8 @@
"params": [], "params": [],
"body": { "body": {
"type": "BlockStatement", "type": "BlockStatement",
"start": 48, "start": 49,
"end": 50, "end": 51,
"loc": { "loc": {
"start": { "start": {
"line": 8, "line": 8,

View File

@ -3,7 +3,7 @@ class Foo {
['y'] ['y']
} }
class Foo { class Foo2 {
[p] [p]
[m] () {} [m] () {}
} }

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 60, "end": 61,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -15,7 +15,7 @@
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 60, "end": 61,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -155,7 +155,7 @@
{ {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 29, "start": 29,
"end": 60, "end": 61,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
@ -169,7 +169,7 @@
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 35, "start": 35,
"end": 38, "end": 39,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
@ -177,21 +177,21 @@
}, },
"end": { "end": {
"line": 6, "line": 6,
"column": 9 "column": 10
}, },
"identifierName": "Foo" "identifierName": "Foo2"
}, },
"name": "Foo" "name": "Foo2"
}, },
"superClass": null, "superClass": null,
"body": { "body": {
"type": "ClassBody", "type": "ClassBody",
"start": 39, "start": 40,
"end": 60, "end": 61,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
"column": 10 "column": 11
}, },
"end": { "end": {
"line": 9, "line": 9,
@ -201,8 +201,8 @@
"body": [ "body": [
{ {
"type": "ClassProperty", "type": "ClassProperty",
"start": 43, "start": 44,
"end": 46, "end": 47,
"loc": { "loc": {
"start": { "start": {
"line": 7, "line": 7,
@ -217,8 +217,8 @@
"computed": true, "computed": true,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 44, "start": 45,
"end": 45, "end": 46,
"loc": { "loc": {
"start": { "start": {
"line": 7, "line": 7,
@ -236,8 +236,8 @@
}, },
{ {
"type": "ClassMethod", "type": "ClassMethod",
"start": 49, "start": 50,
"end": 58, "end": 59,
"loc": { "loc": {
"start": { "start": {
"line": 8, "line": 8,
@ -252,8 +252,8 @@
"computed": true, "computed": true,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 50, "start": 51,
"end": 51, "end": 52,
"loc": { "loc": {
"start": { "start": {
"line": 8, "line": 8,
@ -274,8 +274,8 @@
"params": [], "params": [],
"body": { "body": {
"type": "BlockStatement", "type": "BlockStatement",
"start": 56, "start": 57,
"end": 58, "end": 59,
"loc": { "loc": {
"start": { "start": {
"line": 8, "line": 8,

View File

@ -1,3 +1,3 @@
class A { class A extends B {
foo = () => super.x(); foo = () => super.x();
} }

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 36, "end": 46,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -15,7 +15,7 @@
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 36, "end": 46,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -32,7 +32,7 @@
{ {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 0, "start": 0,
"end": 36, "end": 46,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -60,15 +60,31 @@
}, },
"name": "A" "name": "A"
}, },
"superClass": null, "superClass": {
"body": { "type": "Identifier",
"type": "ClassBody", "start": 16,
"start": 8, "end": 17,
"end": 36,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 8 "column": 16
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "B"
},
"name": "B"
},
"body": {
"type": "ClassBody",
"start": 18,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 18
}, },
"end": { "end": {
"line": 3, "line": 3,
@ -78,8 +94,8 @@
"body": [ "body": [
{ {
"type": "ClassProperty", "type": "ClassProperty",
"start": 12, "start": 22,
"end": 34, "end": 44,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -93,8 +109,8 @@
"static": false, "static": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 12, "start": 22,
"end": 15, "end": 25,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -111,8 +127,8 @@
"computed": false, "computed": false,
"value": { "value": {
"type": "ArrowFunctionExpression", "type": "ArrowFunctionExpression",
"start": 18, "start": 28,
"end": 33, "end": 43,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -129,8 +145,8 @@
"params": [], "params": [],
"body": { "body": {
"type": "CallExpression", "type": "CallExpression",
"start": 24, "start": 34,
"end": 33, "end": 43,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -143,8 +159,8 @@
}, },
"callee": { "callee": {
"type": "MemberExpression", "type": "MemberExpression",
"start": 24, "start": 34,
"end": 31, "end": 41,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -157,8 +173,8 @@
}, },
"object": { "object": {
"type": "Super", "type": "Super",
"start": 24, "start": 34,
"end": 29, "end": 39,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -172,8 +188,8 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 30, "start": 40,
"end": 31, "end": 41,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,

View File

@ -1,4 +1,4 @@
class A{ class A extends B {
constructor(){ constructor(){
super()?.b; super()?.b;
} }

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 55, "end": 66,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -15,7 +15,7 @@
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 55, "end": 66,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -32,7 +32,7 @@
{ {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 0, "start": 0,
"end": 55, "end": 66,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -60,15 +60,31 @@
}, },
"name": "A" "name": "A"
}, },
"superClass": null, "superClass": {
"body": { "type": "Identifier",
"type": "ClassBody", "start": 16,
"start": 7, "end": 17,
"end": 55,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 7 "column": 16
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "B"
},
"name": "B"
},
"body": {
"type": "ClassBody",
"start": 18,
"end": 66,
"loc": {
"start": {
"line": 1,
"column": 18
}, },
"end": { "end": {
"line": 5, "line": 5,
@ -78,8 +94,8 @@
"body": [ "body": [
{ {
"type": "ClassMethod", "type": "ClassMethod",
"start": 13, "start": 24,
"end": 53, "end": 64,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -93,8 +109,8 @@
"static": false, "static": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 13, "start": 24,
"end": 24, "end": 35,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -116,8 +132,8 @@
"params": [], "params": [],
"body": { "body": {
"type": "BlockStatement", "type": "BlockStatement",
"start": 26, "start": 37,
"end": 53, "end": 64,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -131,8 +147,8 @@
"body": [ "body": [
{ {
"type": "ExpressionStatement", "type": "ExpressionStatement",
"start": 36, "start": 47,
"end": 47, "end": 58,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -145,8 +161,8 @@
}, },
"expression": { "expression": {
"type": "OptionalMemberExpression", "type": "OptionalMemberExpression",
"start": 36, "start": 47,
"end": 46, "end": 57,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -159,8 +175,8 @@
}, },
"object": { "object": {
"type": "CallExpression", "type": "CallExpression",
"start": 36, "start": 47,
"end": 43, "end": 54,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -173,8 +189,8 @@
}, },
"callee": { "callee": {
"type": "Super", "type": "Super",
"start": 36, "start": 47,
"end": 41, "end": 52,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -190,8 +206,8 @@
}, },
"property": { "property": {
"type": "Identifier", "type": "Identifier",
"start": 45, "start": 56,
"end": 46, "end": 57,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,

View File

@ -1,2 +1,2 @@
const fn: ( Object, ?Object ) => void = ( o1, o2 ) => o1; const fn: ( Object, ?Object ) => void = ( o1, o2 ) => o1;
const fn: ( Object, ?Object, ) => void = ( o1, o2, ) => o1; const fn2: ( Object, ?Object, ) => void = ( o1, o2, ) => o1;

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 117, "end": 118,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -9,13 +9,13 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 59 "column": 60
} }
}, },
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 117, "end": 118,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -23,7 +23,7 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 59 "column": 60
} }
}, },
"sourceType": "module", "sourceType": "module",
@ -317,7 +317,7 @@
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 58, "start": 58,
"end": 117, "end": 118,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -325,14 +325,14 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 59 "column": 60
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 64, "start": 64,
"end": 116, "end": 117,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -340,13 +340,13 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 58 "column": 59
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 64, "start": 64,
"end": 96, "end": 97,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -354,83 +354,83 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 38 "column": 39
}, },
"identifierName": "fn" "identifierName": "fn2"
}, },
"name": "fn", "name": "fn2",
"typeAnnotation": { "typeAnnotation": {
"type": "TypeAnnotation", "type": "TypeAnnotation",
"start": 66, "start": 67,
"end": 96, "end": 97,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 8 "column": 9
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 38 "column": 39
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "FunctionTypeAnnotation", "type": "FunctionTypeAnnotation",
"start": 68, "start": 69,
"end": 96, "end": 97,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 10 "column": 11
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 38 "column": 39
} }
}, },
"params": [ "params": [
{ {
"type": "FunctionTypeParam", "type": "FunctionTypeParam",
"start": 70, "start": 71,
"end": 77, "end": 78,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 12 "column": 13
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 19 "column": 20
} }
}, },
"name": null, "name": null,
"optional": false, "optional": false,
"typeAnnotation": { "typeAnnotation": {
"type": "GenericTypeAnnotation", "type": "GenericTypeAnnotation",
"start": 70, "start": 71,
"end": 76, "end": 77,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 12 "column": 13
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 18 "column": 19
} }
}, },
"typeParameters": null, "typeParameters": null,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 70, "start": 71,
"end": 76, "end": 77,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 12 "column": 13
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 18 "column": 19
}, },
"identifierName": "Object" "identifierName": "Object"
}, },
@ -440,38 +440,24 @@
}, },
{ {
"type": "FunctionTypeParam", "type": "FunctionTypeParam",
"start": 78, "start": 79,
"end": 85, "end": 86,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 20 "column": 21
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 27 "column": 28
} }
}, },
"name": null, "name": null,
"optional": false, "optional": false,
"typeAnnotation": { "typeAnnotation": {
"type": "NullableTypeAnnotation", "type": "NullableTypeAnnotation",
"start": 78,
"end": 85,
"loc": {
"start": {
"line": 2,
"column": 20
},
"end": {
"line": 2,
"column": 27
}
},
"typeAnnotation": {
"type": "GenericTypeAnnotation",
"start": 79, "start": 79,
"end": 85, "end": 86,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -479,22 +465,36 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 27 "column": 28
}
},
"typeAnnotation": {
"type": "GenericTypeAnnotation",
"start": 80,
"end": 86,
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 28
} }
}, },
"typeParameters": null, "typeParameters": null,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 79, "start": 80,
"end": 85, "end": 86,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 21 "column": 22
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 27 "column": 28
}, },
"identifierName": "Object" "identifierName": "Object"
}, },
@ -507,16 +507,16 @@
"rest": null, "rest": null,
"returnType": { "returnType": {
"type": "VoidTypeAnnotation", "type": "VoidTypeAnnotation",
"start": 92, "start": 93,
"end": 96, "end": 97,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 34 "column": 35
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 38 "column": 39
} }
} }
}, },
@ -526,16 +526,16 @@
}, },
"init": { "init": {
"type": "ArrowFunctionExpression", "type": "ArrowFunctionExpression",
"start": 99, "start": 100,
"end": 116, "end": 117,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 41 "column": 42
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 58 "column": 59
} }
}, },
"id": null, "id": null,
@ -544,16 +544,16 @@
"params": [ "params": [
{ {
"type": "Identifier", "type": "Identifier",
"start": 101, "start": 102,
"end": 103, "end": 104,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 43 "column": 44
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 45 "column": 46
}, },
"identifierName": "o1" "identifierName": "o1"
}, },
@ -561,16 +561,16 @@
}, },
{ {
"type": "Identifier", "type": "Identifier",
"start": 105, "start": 106,
"end": 107, "end": 108,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 47 "column": 48
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 49 "column": 50
}, },
"identifierName": "o2" "identifierName": "o2"
}, },
@ -579,16 +579,16 @@
], ],
"body": { "body": {
"type": "Identifier", "type": "Identifier",
"start": 114, "start": 115,
"end": 116, "end": 117,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 56 "column": 57
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 58 "column": 59
}, },
"identifierName": "o1" "identifierName": "o1"
}, },

View File

@ -0,0 +1 @@
import type, { foo } from "bar";

View File

@ -0,0 +1,155 @@
{
"type": "File",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"program": {
"type": "Program",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 32
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "type"
},
"name": "type"
}
},
{
"type": "ImportSpecifier",
"start": 15,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 15,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "foo"
},
"name": "foo"
},
"importKind": null,
"local": {
"type": "Identifier",
"start": 15,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 18
},
"identifierName": "foo"
},
"name": "foo"
}
}
],
"importKind": "value",
"source": {
"type": "StringLiteral",
"start": 26,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 31
}
},
"extra": {
"rawValue": "bar",
"raw": "\"bar\""
},
"value": "bar"
}
}
],
"directives": []
}
}

View File

@ -5,7 +5,7 @@ import {type as as foo} from "foo";
import {type t as u} from "foo"; import {type t as u} from "foo";
import {type switch} from "foo"; import {type switch} from "foo";
import {typeof t} from "foo"; import {typeof t2} from "foo";
import {typeof as} from "foo"; import {typeof as2} from "foo";
import {typeof t as u} from "foo"; import {typeof t as u2} from "foo";
import {typeof switch} from "foo"; import {typeof switch2} from "foo";

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 316, "end": 320,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -9,13 +9,13 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 34 "column": 35
} }
}, },
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 316, "end": 320,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -23,7 +23,7 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 34 "column": 35
} }
}, },
"sourceType": "module", "sourceType": "module",
@ -560,7 +560,7 @@
{ {
"type": "ImportDeclaration", "type": "ImportDeclaration",
"start": 186, "start": 186,
"end": 215, "end": 216,
"loc": { "loc": {
"start": { "start": {
"line": 8, "line": 8,
@ -568,161 +568,73 @@
}, },
"end": { "end": {
"line": 8, "line": 8,
"column": 29
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 194,
"end": 202,
"loc": {
"start": {
"line": 8,
"column": 8
},
"end": {
"line": 8,
"column": 16
}
},
"imported": {
"type": "Identifier",
"start": 201,
"end": 202,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 16
},
"identifierName": "t"
},
"name": "t"
},
"importKind": "typeof",
"local": {
"type": "Identifier",
"start": 201,
"end": 202,
"loc": {
"start": {
"line": 8,
"column": 15
},
"end": {
"line": 8,
"column": 16
},
"identifierName": "t"
},
"name": "t"
}
}
],
"importKind": "value",
"source": {
"type": "StringLiteral",
"start": 209,
"end": 214,
"loc": {
"start": {
"line": 8,
"column": 23
},
"end": {
"line": 8,
"column": 28
}
},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
}
},
{
"type": "ImportDeclaration",
"start": 216,
"end": 246,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 30 "column": 30
} }
}, },
"specifiers": [ "specifiers": [
{ {
"type": "ImportSpecifier", "type": "ImportSpecifier",
"start": 224, "start": 194,
"end": 233, "end": 203,
"loc": { "loc": {
"start": { "start": {
"line": 9, "line": 8,
"column": 8 "column": 8
}, },
"end": { "end": {
"line": 9, "line": 8,
"column": 17 "column": 17
} }
}, },
"imported": { "imported": {
"type": "Identifier", "type": "Identifier",
"start": 231, "start": 201,
"end": 233, "end": 203,
"loc": { "loc": {
"start": { "start": {
"line": 9, "line": 8,
"column": 15 "column": 15
}, },
"end": { "end": {
"line": 9, "line": 8,
"column": 17 "column": 17
}, },
"identifierName": "as" "identifierName": "t2"
}, },
"name": "as" "name": "t2"
}, },
"importKind": "typeof", "importKind": "typeof",
"local": { "local": {
"type": "Identifier", "type": "Identifier",
"start": 231, "start": 201,
"end": 233, "end": 203,
"loc": { "loc": {
"start": { "start": {
"line": 9, "line": 8,
"column": 15 "column": 15
}, },
"end": { "end": {
"line": 9, "line": 8,
"column": 17 "column": 17
}, },
"identifierName": "as" "identifierName": "t2"
}, },
"name": "as" "name": "t2"
} }
} }
], ],
"importKind": "value", "importKind": "value",
"source": { "source": {
"type": "StringLiteral", "type": "StringLiteral",
"start": 240, "start": 210,
"end": 245, "end": 215,
"loc": { "loc": {
"start": { "start": {
"line": 9, "line": 8,
"column": 24 "column": 24
}, },
"end": { "end": {
"line": 9, "line": 8,
"column": 29 "column": 29
} }
}, },
@ -735,8 +647,96 @@
}, },
{ {
"type": "ImportDeclaration", "type": "ImportDeclaration",
"start": 247, "start": 217,
"end": 281, "end": 248,
"loc": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 31
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 225,
"end": 235,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 18
}
},
"imported": {
"type": "Identifier",
"start": 232,
"end": 235,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 9,
"column": 18
},
"identifierName": "as2"
},
"name": "as2"
},
"importKind": "typeof",
"local": {
"type": "Identifier",
"start": 232,
"end": 235,
"loc": {
"start": {
"line": 9,
"column": 15
},
"end": {
"line": 9,
"column": 18
},
"identifierName": "as2"
},
"name": "as2"
}
}
],
"importKind": "value",
"source": {
"type": "StringLiteral",
"start": 242,
"end": 247,
"loc": {
"start": {
"line": 9,
"column": 25
},
"end": {
"line": 9,
"column": 30
}
},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
}
},
{
"type": "ImportDeclaration",
"start": 249,
"end": 284,
"loc": { "loc": {
"start": { "start": {
"line": 10, "line": 10,
@ -744,14 +744,14 @@
}, },
"end": { "end": {
"line": 10, "line": 10,
"column": 34 "column": 35
} }
}, },
"specifiers": [ "specifiers": [
{ {
"type": "ImportSpecifier", "type": "ImportSpecifier",
"start": 255, "start": 257,
"end": 268, "end": 271,
"loc": { "loc": {
"start": { "start": {
"line": 10, "line": 10,
@ -759,13 +759,13 @@
}, },
"end": { "end": {
"line": 10, "line": 10,
"column": 21 "column": 22
} }
}, },
"imported": { "imported": {
"type": "Identifier", "type": "Identifier",
"start": 262, "start": 264,
"end": 263, "end": 265,
"loc": { "loc": {
"start": { "start": {
"line": 10, "line": 10,
@ -782,8 +782,8 @@
"importKind": "typeof", "importKind": "typeof",
"local": { "local": {
"type": "Identifier", "type": "Identifier",
"start": 267, "start": 269,
"end": 268, "end": 271,
"loc": { "loc": {
"start": { "start": {
"line": 10, "line": 10,
@ -791,27 +791,27 @@
}, },
"end": { "end": {
"line": 10, "line": 10,
"column": 21 "column": 22
}, },
"identifierName": "u" "identifierName": "u2"
}, },
"name": "u" "name": "u2"
} }
} }
], ],
"importKind": "value", "importKind": "value",
"source": { "source": {
"type": "StringLiteral", "type": "StringLiteral",
"start": 275, "start": 278,
"end": 280, "end": 283,
"loc": { "loc": {
"start": { "start": {
"line": 10, "line": 10,
"column": 28 "column": 29
}, },
"end": { "end": {
"line": 10, "line": 10,
"column": 33 "column": 34
} }
}, },
"extra": { "extra": {
@ -823,8 +823,8 @@
}, },
{ {
"type": "ImportDeclaration", "type": "ImportDeclaration",
"start": 282, "start": 285,
"end": 316, "end": 320,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -832,14 +832,14 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 34 "column": 35
} }
}, },
"specifiers": [ "specifiers": [
{ {
"type": "ImportSpecifier", "type": "ImportSpecifier",
"start": 290, "start": 293,
"end": 303, "end": 307,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -847,13 +847,13 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 21 "column": 22
} }
}, },
"imported": { "imported": {
"type": "Identifier", "type": "Identifier",
"start": 297, "start": 300,
"end": 303, "end": 307,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -861,17 +861,17 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 21 "column": 22
}, },
"identifierName": "switch" "identifierName": "switch2"
}, },
"name": "switch" "name": "switch2"
}, },
"importKind": "typeof", "importKind": "typeof",
"local": { "local": {
"type": "Identifier", "type": "Identifier",
"start": 297, "start": 300,
"end": 303, "end": 307,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -879,27 +879,27 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 21 "column": 22
}, },
"identifierName": "switch" "identifierName": "switch2"
}, },
"name": "switch" "name": "switch2"
} }
} }
], ],
"importKind": "value", "importKind": "value",
"source": { "source": {
"type": "StringLiteral", "type": "StringLiteral",
"start": 310, "start": 314,
"end": 315, "end": 319,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
"column": 28 "column": 29
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 33 "column": 34
} }
}, },
"extra": { "extra": {

View File

@ -1,14 +1,13 @@
import type Def from "foo"; import type Def1 from "foo";
import type {named} from "foo"; import type {named1} from "foo";
import type Def, {named} from "foo"; import type Def2, {named2} from "foo";
import type switch from "foo"; import type switch1 from "foo";
import type { switch } from "foo"; import type { switch2 } from "foo";
import type { foo, bar } from "baz"; import type { foo1, bar1 } from "baz";
import type from "foo"; import type from "foo";
import type, { foo } from "bar"; import typeof foo3 from "bar";
import typeof foo from "bar"; import typeof switch4 from "foo";
import typeof switch from "foo"; import typeof { switch5 } from "foo";
import typeof { switch } from "foo"; import typeof { foo as bar6 } from "baz";
import typeof { foo as bar } from "baz"; import typeof * as ns7 from "foo";
import typeof * as ns from "foo"; import typeof * as switch8 from "foo";
import typeof * as switch from "foo";

View File

@ -1,22 +1,22 @@
type A<T = string> = T type A1<T = string> = T
type A<T = *> = T type A2<T = *> = T
type A<T: ?string = string> = T type A3<T: ?string = string> = T
type A<S, T: ?string = string> = T type A4<S, T: ?string = string> = T
type A<S = number, T: ?string = string> = T type A5<S = number, T: ?string = string> = T
class A<T = string> {} class A6<T = string> {}
class A<T: ?string = string> {} class A7<T: ?string = string> {}
class A<S, T: ?string = string> {} class A8<S, T: ?string = string> {}
class A<S = number, T: ?string = string> {} class A9<S = number, T: ?string = string> {}
;(class A<T = string> {}) ;(class A10<T = string> {})
;(class A<T: ?string = string> {}) ;(class A11<T: ?string = string> {})
;(class A<S, T: ?string = string> {}) ;(class A12<S, T: ?string = string> {})
;(class A<S = number, T: ?string = string> {}) ;(class A13<S = number, T: ?string = string> {})
declare class A<T = string> {} declare class A14<T = string> {}
declare class A<T: ?string = string> {} declare class A15<T: ?string = string> {}
declare class A<S, T: ?string = string> {} declare class A16<S, T: ?string = string> {}
declare class A<S = number, T: ?string = string> {} declare class A17<S = number, T: ?string = string> {}
interface A<T = string> {} interface A18<T = string> {}
interface A<T: ?string = string> {} interface A19<T: ?string = string> {}
interface A<S, T: ?string = string> {} interface A20<S, T: ?string = string> {}
interface A<S = number, T: ?string = string> {} interface A21<S = number, T: ?string = string> {}
type A<T = void> = T type A22<T = void> = T

View File

@ -8,7 +8,7 @@ async ([a, [b: string]]) => {};
async ([a: string] = []) => {}; async ([a: string] = []) => {};
async ({ x: [a: string] }) => {}; async ({ x: [a: string] }) => {};
let [a: string] = c; let [a1: string] = c;
let [a, [b: string]] = c; let [a2, [b: string]] = c;
let [a: string] = c; let [a3: string] = c;
let { x: [a: string] } = c; let { x: [a4: string] } = c;

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 323, "end": 327,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -9,13 +9,13 @@
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 27 "column": 28
} }
}, },
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 323, "end": 327,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -23,7 +23,7 @@
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 27 "column": 28
} }
}, },
"sourceType": "module", "sourceType": "module",
@ -1194,7 +1194,7 @@
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 228, "start": 228,
"end": 248, "end": 249,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -1202,14 +1202,14 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 20 "column": 21
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 232, "start": 232,
"end": 247, "end": 248,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -1217,13 +1217,13 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 19 "column": 20
} }
}, },
"id": { "id": {
"type": "ArrayPattern", "type": "ArrayPattern",
"start": 232, "start": 232,
"end": 243, "end": 244,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -1231,14 +1231,14 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 15 "column": 16
} }
}, },
"elements": [ "elements": [
{ {
"type": "Identifier", "type": "Identifier",
"start": 233, "start": 233,
"end": 242, "end": 243,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
@ -1246,37 +1246,37 @@
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 14 "column": 15
}, },
"identifierName": "a" "identifierName": "a1"
}, },
"name": "a", "name": "a1",
"typeAnnotation": { "typeAnnotation": {
"type": "TypeAnnotation", "type": "TypeAnnotation",
"start": 234, "start": 235,
"end": 242, "end": 243,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
"column": 6 "column": 7
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 14 "column": 15
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "StringTypeAnnotation", "type": "StringTypeAnnotation",
"start": 236, "start": 237,
"end": 242, "end": 243,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
"column": 8 "column": 9
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 14 "column": 15
} }
} }
} }
@ -1286,16 +1286,16 @@
}, },
"init": { "init": {
"type": "Identifier", "type": "Identifier",
"start": 246, "start": 247,
"end": 247, "end": 248,
"loc": { "loc": {
"start": { "start": {
"line": 11, "line": 11,
"column": 18 "column": 19
}, },
"end": { "end": {
"line": 11, "line": 11,
"column": 19 "column": 20
}, },
"identifierName": "c" "identifierName": "c"
}, },
@ -1307,8 +1307,8 @@
}, },
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 249, "start": 250,
"end": 274, "end": 276,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
@ -1316,14 +1316,14 @@
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 25 "column": 26
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 253, "start": 254,
"end": 273, "end": 275,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
@ -1331,13 +1331,13 @@
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 24 "column": 25
} }
}, },
"id": { "id": {
"type": "ArrayPattern", "type": "ArrayPattern",
"start": 253, "start": 254,
"end": 269, "end": 271,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
@ -1345,14 +1345,14 @@
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 20 "column": 21
} }
}, },
"elements": [ "elements": [
{ {
"type": "Identifier", "type": "Identifier",
"start": 254, "start": 255,
"end": 255, "end": 257,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
@ -1360,31 +1360,16 @@
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 6 "column": 7
}, },
"identifierName": "a" "identifierName": "a2"
}, },
"name": "a" "name": "a2"
}, },
{ {
"type": "ArrayPattern", "type": "ArrayPattern",
"start": 257, "start": 259,
"end": 268, "end": 270,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 19
}
},
"elements": [
{
"type": "Identifier",
"start": 258,
"end": 267,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
@ -1392,15 +1377,14 @@
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 18 "column": 20
}
}, },
"identifierName": "b" "elements": [
}, {
"name": "b", "type": "Identifier",
"typeAnnotation": { "start": 260,
"type": "TypeAnnotation", "end": 269,
"start": 259,
"end": 267,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
@ -1408,21 +1392,37 @@
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 18 "column": 19
},
"identifierName": "b"
},
"name": "b",
"typeAnnotation": {
"type": "TypeAnnotation",
"start": 261,
"end": 269,
"loc": {
"start": {
"line": 12,
"column": 11
},
"end": {
"line": 12,
"column": 19
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "StringTypeAnnotation", "type": "StringTypeAnnotation",
"start": 261, "start": 263,
"end": 267, "end": 269,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
"column": 12 "column": 13
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 18 "column": 19
} }
} }
} }
@ -1434,16 +1434,16 @@
}, },
"init": { "init": {
"type": "Identifier", "type": "Identifier",
"start": 272, "start": 274,
"end": 273, "end": 275,
"loc": { "loc": {
"start": { "start": {
"line": 12, "line": 12,
"column": 23 "column": 24
}, },
"end": { "end": {
"line": 12, "line": 12,
"column": 24 "column": 25
}, },
"identifierName": "c" "identifierName": "c"
}, },
@ -1455,8 +1455,8 @@
}, },
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 275, "start": 277,
"end": 295, "end": 298,
"loc": { "loc": {
"start": { "start": {
"line": 13, "line": 13,
@ -1464,14 +1464,14 @@
}, },
"end": { "end": {
"line": 13, "line": 13,
"column": 20 "column": 21
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 279, "start": 281,
"end": 294, "end": 297,
"loc": { "loc": {
"start": { "start": {
"line": 13, "line": 13,
@ -1479,13 +1479,13 @@
}, },
"end": { "end": {
"line": 13, "line": 13,
"column": 19 "column": 20
} }
}, },
"id": { "id": {
"type": "ArrayPattern", "type": "ArrayPattern",
"start": 279, "start": 281,
"end": 290, "end": 293,
"loc": { "loc": {
"start": { "start": {
"line": 13, "line": 13,
@ -1493,14 +1493,14 @@
}, },
"end": { "end": {
"line": 13, "line": 13,
"column": 15 "column": 16
} }
}, },
"elements": [ "elements": [
{ {
"type": "Identifier", "type": "Identifier",
"start": 280, "start": 282,
"end": 289, "end": 292,
"loc": { "loc": {
"start": { "start": {
"line": 13, "line": 13,
@ -1508,37 +1508,37 @@
}, },
"end": { "end": {
"line": 13, "line": 13,
"column": 14 "column": 15
}, },
"identifierName": "a" "identifierName": "a3"
}, },
"name": "a", "name": "a3",
"typeAnnotation": { "typeAnnotation": {
"type": "TypeAnnotation", "type": "TypeAnnotation",
"start": 281, "start": 284,
"end": 289, "end": 292,
"loc": { "loc": {
"start": { "start": {
"line": 13, "line": 13,
"column": 6 "column": 7
}, },
"end": { "end": {
"line": 13, "line": 13,
"column": 14 "column": 15
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "StringTypeAnnotation", "type": "StringTypeAnnotation",
"start": 283, "start": 286,
"end": 289, "end": 292,
"loc": { "loc": {
"start": { "start": {
"line": 13, "line": 13,
"column": 8 "column": 9
}, },
"end": { "end": {
"line": 13, "line": 13,
"column": 14 "column": 15
} }
} }
} }
@ -1548,16 +1548,16 @@
}, },
"init": { "init": {
"type": "Identifier", "type": "Identifier",
"start": 293, "start": 296,
"end": 294, "end": 297,
"loc": { "loc": {
"start": { "start": {
"line": 13, "line": 13,
"column": 18 "column": 19
}, },
"end": { "end": {
"line": 13, "line": 13,
"column": 19 "column": 20
}, },
"identifierName": "c" "identifierName": "c"
}, },
@ -1569,8 +1569,8 @@
}, },
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 296, "start": 299,
"end": 323, "end": 327,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
@ -1578,13 +1578,27 @@
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 27 "column": 28
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 300, "start": 303,
"end": 326,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 27
}
},
"id": {
"type": "ObjectPattern",
"start": 303,
"end": 322, "end": 322,
"loc": { "loc": {
"start": { "start": {
@ -1593,28 +1607,14 @@
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 26 "column": 23
}
},
"id": {
"type": "ObjectPattern",
"start": 300,
"end": 318,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 14,
"column": 22
} }
}, },
"properties": [ "properties": [
{ {
"type": "ObjectProperty", "type": "ObjectProperty",
"start": 302, "start": 305,
"end": 316, "end": 320,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
@ -1622,14 +1622,14 @@
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 20 "column": 21
} }
}, },
"method": false, "method": false,
"key": { "key": {
"type": "Identifier", "type": "Identifier",
"start": 302, "start": 305,
"end": 303, "end": 306,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
@ -1647,8 +1647,8 @@
"shorthand": false, "shorthand": false,
"value": { "value": {
"type": "ArrayPattern", "type": "ArrayPattern",
"start": 305, "start": 308,
"end": 316, "end": 320,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
@ -1656,14 +1656,14 @@
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 20 "column": 21
} }
}, },
"elements": [ "elements": [
{ {
"type": "Identifier", "type": "Identifier",
"start": 306, "start": 309,
"end": 315, "end": 319,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
@ -1671,37 +1671,37 @@
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 19 "column": 20
}, },
"identifierName": "a" "identifierName": "a4"
}, },
"name": "a", "name": "a4",
"typeAnnotation": { "typeAnnotation": {
"type": "TypeAnnotation", "type": "TypeAnnotation",
"start": 307, "start": 311,
"end": 315, "end": 319,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
"column": 11 "column": 12
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 19 "column": 20
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "StringTypeAnnotation", "type": "StringTypeAnnotation",
"start": 309, "start": 313,
"end": 315, "end": 319,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
"column": 13 "column": 14
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 19 "column": 20
} }
} }
} }
@ -1714,16 +1714,16 @@
}, },
"init": { "init": {
"type": "Identifier", "type": "Identifier",
"start": 321, "start": 325,
"end": 322, "end": 326,
"loc": { "loc": {
"start": { "start": {
"line": 14, "line": 14,
"column": 25 "column": 26
}, },
"end": { "end": {
"line": 14, "line": 14,
"column": 26 "column": 27
}, },
"identifierName": "c" "identifierName": "c"
}, },

View File

@ -1,7 +1,7 @@
abstract class C {} abstract class C1 {}
declare abstract class C {} declare abstract class C2 {}
export abstract class C {} export abstract class C3 {}
// `export abstract class {}` is not valid TypeScript. // `export abstract class {}` is not valid TypeScript.
export default abstract class { } export default abstract class { }
export default abstract class C { } export default abstract class C4 { }
// `abstract class` is not valid as an expression. // `abstract class` is not valid as an expression.

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 250, "end": 254,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -15,7 +15,7 @@
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 250, "end": 254,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -32,7 +32,7 @@
{ {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 0, "start": 0,
"end": 19, "end": 20,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -40,14 +40,14 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 19 "column": 20
} }
}, },
"abstract": true, "abstract": true,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 15, "start": 15,
"end": 16, "end": 17,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -55,25 +55,25 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 16 "column": 17
}, },
"identifierName": "C" "identifierName": "C1"
}, },
"name": "C" "name": "C1"
}, },
"superClass": null, "superClass": null,
"body": { "body": {
"type": "ClassBody", "type": "ClassBody",
"start": 17, "start": 18,
"end": 19, "end": 20,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 17 "column": 18
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 19 "column": 20
} }
}, },
"body": [] "body": []
@ -81,8 +81,8 @@
}, },
{ {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 20, "start": 21,
"end": 47, "end": 49,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -90,14 +90,14 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 27 "column": 28
} }
}, },
"abstract": true, "abstract": true,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 43, "start": 44,
"end": 44, "end": 46,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -105,25 +105,25 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 24 "column": 25
}, },
"identifierName": "C" "identifierName": "C2"
}, },
"name": "C" "name": "C2"
}, },
"superClass": null, "superClass": null,
"body": { "body": {
"type": "ClassBody", "type": "ClassBody",
"start": 45, "start": 47,
"end": 47, "end": 49,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 25 "column": 26
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 27 "column": 28
} }
}, },
"body": [] "body": []
@ -132,8 +132,8 @@
}, },
{ {
"type": "ExportNamedDeclaration", "type": "ExportNamedDeclaration",
"start": 48, "start": 50,
"end": 74, "end": 77,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -141,15 +141,15 @@
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 26 "column": 27
} }
}, },
"specifiers": [], "specifiers": [],
"source": null, "source": null,
"declaration": { "declaration": {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 55, "start": 57,
"end": 74, "end": 77,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -157,14 +157,14 @@
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 26 "column": 27
} }
}, },
"abstract": true, "abstract": true,
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 70, "start": 72,
"end": 71, "end": 74,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -172,25 +172,25 @@
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 23 "column": 24
}, },
"identifierName": "C" "identifierName": "C3"
}, },
"name": "C" "name": "C3"
}, },
"superClass": null, "superClass": null,
"body": { "body": {
"type": "ClassBody", "type": "ClassBody",
"start": 72, "start": 75,
"end": 74, "end": 77,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
"column": 24 "column": 25
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 26 "column": 27
} }
}, },
"body": [] "body": []
@ -200,8 +200,8 @@
{ {
"type": "CommentLine", "type": "CommentLine",
"value": " `export abstract class {}` is not valid TypeScript.", "value": " `export abstract class {}` is not valid TypeScript.",
"start": 75, "start": 78,
"end": 129, "end": 132,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
@ -217,8 +217,8 @@
}, },
{ {
"type": "ExportDefaultDeclaration", "type": "ExportDefaultDeclaration",
"start": 130, "start": 133,
"end": 163, "end": 166,
"loc": { "loc": {
"start": { "start": {
"line": 5, "line": 5,
@ -231,8 +231,8 @@
}, },
"declaration": { "declaration": {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 145, "start": 148,
"end": 163, "end": 166,
"loc": { "loc": {
"start": { "start": {
"line": 5, "line": 5,
@ -247,8 +247,8 @@
"superClass": null, "superClass": null,
"body": { "body": {
"type": "ClassBody", "type": "ClassBody",
"start": 160, "start": 163,
"end": 163, "end": 166,
"loc": { "loc": {
"start": { "start": {
"line": 5, "line": 5,
@ -267,8 +267,8 @@
{ {
"type": "CommentLine", "type": "CommentLine",
"value": " `export abstract class {}` is not valid TypeScript.", "value": " `export abstract class {}` is not valid TypeScript.",
"start": 75, "start": 78,
"end": 129, "end": 132,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
@ -284,8 +284,8 @@
}, },
{ {
"type": "ExportDefaultDeclaration", "type": "ExportDefaultDeclaration",
"start": 164, "start": 167,
"end": 199, "end": 203,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
@ -293,13 +293,13 @@
}, },
"end": { "end": {
"line": 6, "line": 6,
"column": 35 "column": 36
} }
}, },
"declaration": { "declaration": {
"type": "ClassDeclaration", "type": "ClassDeclaration",
"start": 179, "start": 182,
"end": 199, "end": 203,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
@ -307,13 +307,13 @@
}, },
"end": { "end": {
"line": 6, "line": 6,
"column": 35 "column": 36
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 194, "start": 197,
"end": 195, "end": 199,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
@ -321,25 +321,25 @@
}, },
"end": { "end": {
"line": 6, "line": 6,
"column": 31 "column": 32
}, },
"identifierName": "C" "identifierName": "C4"
}, },
"name": "C" "name": "C4"
}, },
"superClass": null, "superClass": null,
"body": { "body": {
"type": "ClassBody", "type": "ClassBody",
"start": 196, "start": 200,
"end": 199, "end": 203,
"loc": { "loc": {
"start": { "start": {
"line": 6, "line": 6,
"column": 32 "column": 33
}, },
"end": { "end": {
"line": 6, "line": 6,
"column": 35 "column": 36
} }
}, },
"body": [] "body": []
@ -350,8 +350,8 @@
{ {
"type": "CommentLine", "type": "CommentLine",
"value": " `abstract class` is not valid as an expression.", "value": " `abstract class` is not valid as an expression.",
"start": 200, "start": 204,
"end": 250, "end": 254,
"loc": { "loc": {
"start": { "start": {
"line": 7, "line": 7,
@ -372,8 +372,8 @@
{ {
"type": "CommentLine", "type": "CommentLine",
"value": " `export abstract class {}` is not valid TypeScript.", "value": " `export abstract class {}` is not valid TypeScript.",
"start": 75, "start": 78,
"end": 129, "end": 132,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
@ -388,8 +388,8 @@
{ {
"type": "CommentLine", "type": "CommentLine",
"value": " `abstract class` is not valid as an expression.", "value": " `abstract class` is not valid as an expression.",
"start": 200, "start": 204,
"end": 250, "end": 254,
"loc": { "loc": {
"start": { "start": {
"line": 7, "line": 7,

View File

@ -1,2 +1,2 @@
let x: true; let x1: true;
let x: false; let x2: false;

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 26, "end": 28,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -9,13 +9,13 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 13 "column": 14
} }
}, },
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 26, "end": 28,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -23,7 +23,7 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 13 "column": 14
} }
}, },
"sourceType": "module", "sourceType": "module",
@ -32,7 +32,7 @@
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 0, "start": 0,
"end": 12, "end": 13,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -40,14 +40,14 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 12 "column": 13
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 4, "start": 4,
"end": 11, "end": 12,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -55,13 +55,13 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 11 "column": 12
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 4, "start": 4,
"end": 11, "end": 12,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -69,51 +69,51 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 11 "column": 12
}, },
"identifierName": "x" "identifierName": "x1"
}, },
"name": "x", "name": "x1",
"typeAnnotation": { "typeAnnotation": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start": 5, "start": 6,
"end": 11, "end": 12,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 5 "column": 6
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 11 "column": 12
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "TSLiteralType", "type": "TSLiteralType",
"start": 7, "start": 8,
"end": 11, "end": 12,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 11 "column": 12
} }
}, },
"literal": { "literal": {
"type": "BooleanLiteral", "type": "BooleanLiteral",
"start": 7, "start": 8,
"end": 11, "end": 12,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 11 "column": 12
} }
}, },
"value": true "value": true
@ -128,8 +128,8 @@
}, },
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 13, "start": 14,
"end": 26, "end": 28,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -137,14 +137,14 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 13 "column": 14
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 17, "start": 18,
"end": 25, "end": 27,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -152,13 +152,13 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 12 "column": 13
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 17, "start": 18,
"end": 25, "end": 27,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -166,51 +166,51 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 12 "column": 13
}, },
"identifierName": "x" "identifierName": "x2"
}, },
"name": "x", "name": "x2",
"typeAnnotation": { "typeAnnotation": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start": 18, "start": 20,
"end": 25, "end": 27,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 5 "column": 6
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 12 "column": 13
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "TSLiteralType", "type": "TSLiteralType",
"start": 20, "start": 22,
"end": 25, "end": 27,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 12 "column": 13
} }
}, },
"literal": { "literal": {
"type": "BooleanLiteral", "type": "BooleanLiteral",
"start": 20, "start": 22,
"end": 25, "end": 27,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 12 "column": 13
} }
}, },
"value": false "value": false

View File

@ -1,4 +1,4 @@
let map: { [P in string]: number; }; let map1: { [P in string]: number; };
let map: { readonly [P in string]?: number; }; let map2: { readonly [P in string]?: number; };
let map: { +readonly [P in string]+?: number; }; let map3: { +readonly [P in string]+?: number; };
let map: { -readonly [P in string]-?: number }; let map4: { -readonly [P in string]-?: number };

View File

@ -1,7 +1,7 @@
{ {
"type": "File", "type": "File",
"start": 0, "start": 0,
"end": 180, "end": 184,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -9,13 +9,13 @@
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 47 "column": 48
} }
}, },
"program": { "program": {
"type": "Program", "type": "Program",
"start": 0, "start": 0,
"end": 180, "end": 184,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -23,7 +23,7 @@
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 47 "column": 48
} }
}, },
"sourceType": "module", "sourceType": "module",
@ -32,7 +32,7 @@
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 0, "start": 0,
"end": 36, "end": 37,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -40,14 +40,14 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 36 "column": 37
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 4, "start": 4,
"end": 35, "end": 36,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -55,13 +55,13 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 35 "column": 36
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 4, "start": 4,
"end": 35, "end": 36,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
@ -69,82 +69,82 @@
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 35 "column": 36
}, },
"identifierName": "map" "identifierName": "map1"
}, },
"name": "map", "name": "map1",
"typeAnnotation": { "typeAnnotation": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start": 7, "start": 8,
"end": 35, "end": 36,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 35 "column": 36
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "TSMappedType", "type": "TSMappedType",
"start": 9, "start": 10,
"end": 35, "end": 36,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 9 "column": 10
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 35 "column": 36
} }
}, },
"typeParameter": { "typeParameter": {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start": 12, "start": 13,
"end": 23, "end": 24,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 12 "column": 13
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 23 "column": 24
} }
}, },
"name": "P", "name": "P",
"constraint": { "constraint": {
"type": "TSStringKeyword", "type": "TSStringKeyword",
"start": 17, "start": 18,
"end": 23, "end": 24,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 17 "column": 18
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 23 "column": 24
} }
} }
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "TSNumberKeyword", "type": "TSNumberKeyword",
"start": 26, "start": 27,
"end": 32, "end": 33,
"loc": { "loc": {
"start": { "start": {
"line": 1, "line": 1,
"column": 26 "column": 27
}, },
"end": { "end": {
"line": 1, "line": 1,
"column": 32 "column": 33
} }
} }
} }
@ -158,8 +158,8 @@
}, },
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 37, "start": 38,
"end": 83, "end": 85,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -167,14 +167,14 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 46 "column": 47
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 41, "start": 42,
"end": 82, "end": 84,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -182,13 +182,13 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 45 "column": 46
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 41, "start": 42,
"end": 82, "end": 84,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
@ -196,67 +196,67 @@
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 45 "column": 46
}, },
"identifierName": "map" "identifierName": "map2"
}, },
"name": "map", "name": "map2",
"typeAnnotation": { "typeAnnotation": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start": 44, "start": 46,
"end": 82, "end": 84,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 45 "column": 46
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "TSMappedType", "type": "TSMappedType",
"start": 46, "start": 48,
"end": 82, "end": 84,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 9 "column": 10
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 45 "column": 46
} }
}, },
"readonly": true, "readonly": true,
"typeParameter": { "typeParameter": {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start": 58, "start": 60,
"end": 69, "end": 71,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 21 "column": 22
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 32 "column": 33
} }
}, },
"name": "P", "name": "P",
"constraint": { "constraint": {
"type": "TSStringKeyword", "type": "TSStringKeyword",
"start": 63, "start": 65,
"end": 69, "end": 71,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 26 "column": 27
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 32 "column": 33
} }
} }
} }
@ -264,16 +264,16 @@
"optional": true, "optional": true,
"typeAnnotation": { "typeAnnotation": {
"type": "TSNumberKeyword", "type": "TSNumberKeyword",
"start": 73, "start": 75,
"end": 79, "end": 81,
"loc": { "loc": {
"start": { "start": {
"line": 2, "line": 2,
"column": 36 "column": 37
}, },
"end": { "end": {
"line": 2, "line": 2,
"column": 42 "column": 43
} }
} }
} }
@ -287,8 +287,8 @@
}, },
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 84, "start": 86,
"end": 132, "end": 135,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -296,14 +296,14 @@
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 48 "column": 49
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 88, "start": 90,
"end": 131, "end": 134,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -311,13 +311,13 @@
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 47 "column": 48
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 88, "start": 90,
"end": 131, "end": 134,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
@ -325,67 +325,67 @@
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 47 "column": 48
}, },
"identifierName": "map" "identifierName": "map3"
}, },
"name": "map", "name": "map3",
"typeAnnotation": { "typeAnnotation": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start": 91, "start": 94,
"end": 131, "end": 134,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 47 "column": 48
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "TSMappedType", "type": "TSMappedType",
"start": 93, "start": 96,
"end": 131, "end": 134,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
"column": 9 "column": 10
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 47 "column": 48
} }
}, },
"readonly": "+", "readonly": "+",
"typeParameter": { "typeParameter": {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start": 106, "start": 109,
"end": 117, "end": 120,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
"column": 22 "column": 23
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 33 "column": 34
} }
}, },
"name": "P", "name": "P",
"constraint": { "constraint": {
"type": "TSStringKeyword", "type": "TSStringKeyword",
"start": 111, "start": 114,
"end": 117, "end": 120,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
"column": 27 "column": 28
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 33 "column": 34
} }
} }
} }
@ -393,16 +393,16 @@
"optional": "+", "optional": "+",
"typeAnnotation": { "typeAnnotation": {
"type": "TSNumberKeyword", "type": "TSNumberKeyword",
"start": 122, "start": 125,
"end": 128, "end": 131,
"loc": { "loc": {
"start": { "start": {
"line": 3, "line": 3,
"column": 38 "column": 39
}, },
"end": { "end": {
"line": 3, "line": 3,
"column": 44 "column": 45
} }
} }
} }
@ -416,8 +416,8 @@
}, },
{ {
"type": "VariableDeclaration", "type": "VariableDeclaration",
"start": 133, "start": 136,
"end": 180, "end": 184,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
@ -425,14 +425,14 @@
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 47 "column": 48
} }
}, },
"declarations": [ "declarations": [
{ {
"type": "VariableDeclarator", "type": "VariableDeclarator",
"start": 137, "start": 140,
"end": 179, "end": 183,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
@ -440,13 +440,13 @@
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 46 "column": 47
} }
}, },
"id": { "id": {
"type": "Identifier", "type": "Identifier",
"start": 137, "start": 140,
"end": 179, "end": 183,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
@ -454,67 +454,67 @@
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 46 "column": 47
}, },
"identifierName": "map" "identifierName": "map4"
}, },
"name": "map", "name": "map4",
"typeAnnotation": { "typeAnnotation": {
"type": "TSTypeAnnotation", "type": "TSTypeAnnotation",
"start": 140, "start": 144,
"end": 179, "end": 183,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
"column": 7 "column": 8
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 46 "column": 47
} }
}, },
"typeAnnotation": { "typeAnnotation": {
"type": "TSMappedType", "type": "TSMappedType",
"start": 142, "start": 146,
"end": 179, "end": 183,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
"column": 9 "column": 10
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 46 "column": 47
} }
}, },
"readonly": "-", "readonly": "-",
"typeParameter": { "typeParameter": {
"type": "TSTypeParameter", "type": "TSTypeParameter",
"start": 155, "start": 159,
"end": 166, "end": 170,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
"column": 22 "column": 23
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 33 "column": 34
} }
}, },
"name": "P", "name": "P",
"constraint": { "constraint": {
"type": "TSStringKeyword", "type": "TSStringKeyword",
"start": 160, "start": 164,
"end": 166, "end": 170,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
"column": 27 "column": 28
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 33 "column": 34
} }
} }
} }
@ -522,16 +522,16 @@
"optional": "-", "optional": "-",
"typeAnnotation": { "typeAnnotation": {
"type": "TSNumberKeyword", "type": "TSNumberKeyword",
"start": 171, "start": 175,
"end": 177, "end": 181,
"loc": { "loc": {
"start": { "start": {
"line": 4, "line": 4,
"column": 38 "column": 39
}, },
"end": { "end": {
"line": 4, "line": 4,
"column": 44 "column": 45
} }
} }
} }

View File

@ -0,0 +1 @@
import type, { imp } from "bar";

View File

@ -0,0 +1 @@
{ "plugins": ["transform-flow-strip-types", "syntax-class-properties"] }

View File

@ -0,0 +1 @@
import type, { imp } from "bar";

View File

@ -1,29 +1,29 @@
function foo(numVal: any) {} function foo1(numVal: any) {}
function foo(numVal: number) {} function foo2(numVal: number) {}
function foo(numVal: number, strVal: string) {} function foo3(numVal: number, strVal: string) {}
function foo(numVal: number, untypedVal) {} function foo4(numVal: number, untypedVal) {}
function foo(untypedVal, numVal: number) {} function foo5(untypedVal, numVal: number) {}
function foo(nullableNum: ?number) {} function foo6(nullableNum: ?number) {}
function foo(callback: () => void) {} function foo7(callback: () => void) {}
function foo(callback: () => number) {} function foo8(callback: () => number) {}
function foo(callback: (_: bool) => number) {} function foo9(callback: (_: bool) => number) {}
function foo(callback: (_1: bool, _2: string) => number) {} function foo10(callback: (_1: bool, _2: string) => number) {}
function foo(callback: (_1: bool, ...foo: Array<number>) => number) {} function foo11(callback: (_1: bool, ...foo: Array<number>) => number) {}
function foo(): number{} function foo12(): number{}
function foo():() => void {} function foo13():() => void {}
function foo():(_:bool) => number{} function foo14():(_:bool) => number{}
function foo():(_?:bool) => number{} function foo15():(_?:bool) => number{}
function foo(): {} {} function foo16(): {} {}
function foo<T>() {} function foo17<T>() {}
function foo<T,S>() {} function foo18<T,S>() {}
a = function<T,S>() {}; a1 = function<T,S>() {};
a = { set fooProp(value: number) {} }; a2 = { set fooProp(value: number) {} };
a = { set fooProp(value: number): void {} }; a3 = { set fooProp(value: number): void {} };
a = { get fooProp():number{} }; a4 = { get fooProp():number{} };
a = { id<T>(x: T): T {} }; a5 = { id<T>(x: T): T {} };
a = { *id<T>(x: T): T {} }; a6 = { *id<T>(x: T): T {} };
a = { async id<T>(x: T): T {} }; a7 = { async id<T>(x: T): T {} };
a = { 123<T>(x: T): T {} }; a8 = { 123<T>(x: T): T {} };
class Foo { class Foo {
set fooProp(value: number) {} set fooProp(value: number) {}
} }
@ -35,22 +35,22 @@ class Foo3 {
} }
var numVal: number; var numVal: number;
var numVal: number = otherNumVal; var numVal: number = otherNumVal;
var a: { numVal: number }; var a1: { numVal: number };
var a: { numVal: number; }; var a2: { numVal: number; };
var a: { numVal: number; [indexer: string]: number }; var a3: { numVal: number; [indexer: string]: number };
var a: ?{ numVal: number }; var a4: ?{ numVal: number };
var a: { numVal: number; strVal: string } var a5: { numVal: number; strVal: string }
var a: { subObj: {strVal: string} } var a6: { subObj: {strVal: string} }
var a: { subObj: ?{strVal: string} } var a7: { subObj: ?{strVal: string} }
var a: { param1: number; param2: string } var a8: { param1: number; param2: string }
var a: { param1: number; param2?: string } var a9: { param1: number; param2?: string }
var a: { ...any; ...{}|{p: void} }; var a10: { ...any; ...{}|{p: void} };
var a: { [a: number]: string; [b: number]: string; }; var a11: { [a: number]: string; [b: number]: string; };
var a: { add(x: number, ...y: Array<string>): void }; var a12: { add(x: number, ...y: Array<string>): void };
var a: { id<T>(x: T): T; }; var a13: { id<T>(x: T): T; };
var a:Array<number> = [1, 2, 3] var a14:Array<number> = [1, 2, 3]
a = class Foo<T> {} a13 = class Foo<T> {}
a = class Foo<T> extends Bar<T> {} a14 = class Foo<T> extends Bar<T> {}
class Foo4<T> {} class Foo4<T> {}
class Foo5<T> extends Bar<T> {} class Foo5<T> extends Bar<T> {}
class Foo6<T> extends mixin(Bar) {} class Foo6<T> extends mixin(Bar) {}
@ -60,7 +60,7 @@ class Foo7<T> {
class Foo8 { class Foo8 {
"bar"<T>() {} "bar"<T>() {}
} }
function foo(requiredParam, optParam?) {} function foo19(requiredParam, optParam?) {}
class Foo9 { class Foo9 {
prop1: string; prop1: string;
prop2: number; prop2: number;
@ -73,32 +73,31 @@ class Foo11 {
#prop1: string; #prop1: string;
#prop2: number; #prop2: number;
} }
var x: number | string = 4; var x1: number | string = 4;
class Array { concat(items:number | string) {}; } class Array { concat(items:number | string) {}; }
var x: () => number | () => string = fn; var x2: () => number | () => string = fn;
var x: typeof Y = Y; var x3: typeof Y = Y;
var x: typeof Y | number = Y; var x4: typeof Y | number = Y;
var {x}: {x: string; } = { x: "hello" }; var {x5}: {x5: string; } = { x5: "hello" };
var {x}: {x: string } = { x: "hello" }; var {x6}: {x6: string } = { x6: "hello" };
var [x]: Array<string> = [ "hello" ]; var [x7]: Array<string> = [ "hello" ];
function foo({x}: { x: string; }) {} function foo20({x}: { x: string; }) {}
function foo([x]: Array<string>) {} function foo21([x]: Array<string>) {}
function foo(...rest: Array<number>) {} function foo22(...rest: Array<number>) {}
(function (...rest: Array<number>) {}); (function (...rest: Array<number>) {});
((...rest: Array<number>) => rest); ((...rest: Array<number>) => rest);
var a: Map<string, Array<string> > var a15: Map<string, Array<string> >
var a: Map<string, Array<string>> var a16: Map<string, Array<string>>
var a: number[] var a17: number[]
var a: ?string[] var a18: ?string[]
var a: Promise<bool>[] var a19: Promise<bool>[]
var a:(...rest:Array<number>) => number var a20:(...rest:Array<number>) => number
var identity: <T>(x: T) => T var identity1: <T>(x: T) => T
var identity: <T>(x: T, ...y:T[]) => T var identity2: <T>(x: T, ...y:T[]) => T
import type foo4 from "bar"; import type imp1 from "bar";
import type { foo2, bar } from "baz"; import type { imp2, imp3 } from "baz";
import type { foo as bar2 } from "baz"; import type { foo as imp4 } from "baz";
import type from "foo"; import type from "foo";
import type2, { foo3 } from "bar";
import typeof * as namespace from "bar"; import typeof * as namespace from "bar";
export type { foo }; export type { foo };
export type { foo2 } from "bar"; export type { foo2 } from "bar";
@ -106,7 +105,7 @@ import {type T} from "foo";
import {type T2, V1} from "foo"; import {type T2, V1} from "foo";
import {typeof V2} from "foo"; import {typeof V2} from "foo";
import {typeof V3, V4} from "foo"; import {typeof V3, V4} from "foo";
export interface foo5 { p: number } export interface int5 { p: number }
export interface foo6<T> { p: T } export interface int6<T> { p: T }
import 'foo'; import 'foo';
export type * from "foo"; export type * from "foo";

View File

@ -1,66 +1,66 @@
function foo(numVal) {} function foo1(numVal) {}
function foo(numVal) {} function foo2(numVal) {}
function foo(numVal, strVal) {} function foo3(numVal, strVal) {}
function foo(numVal, untypedVal) {} function foo4(numVal, untypedVal) {}
function foo(untypedVal, numVal) {} function foo5(untypedVal, numVal) {}
function foo(nullableNum) {} function foo6(nullableNum) {}
function foo(callback) {} function foo7(callback) {}
function foo(callback) {} function foo8(callback) {}
function foo(callback) {} function foo9(callback) {}
function foo(callback) {} function foo10(callback) {}
function foo(callback) {} function foo11(callback) {}
function foo() {} function foo12() {}
function foo() {} function foo13() {}
function foo() {} function foo14() {}
function foo() {} function foo15() {}
function foo() {} function foo16() {}
function foo() {} function foo17() {}
function foo() {} function foo18() {}
a = function () {}; a1 = function () {};
a = { a2 = {
set fooProp(value) {} set fooProp(value) {}
}; };
a = { a3 = {
set fooProp(value) {} set fooProp(value) {}
}; };
a = { a4 = {
get fooProp() {} get fooProp() {}
}; };
a = { a5 = {
id(x) {} id(x) {}
}; };
a = { a6 = {
*id(x) {} *id(x) {}
}; };
a = { a7 = {
async id(x) {} async id(x) {}
}; };
a = { a8 = {
123(x) {} 123(x) {}
}; };
@ -82,22 +82,22 @@ class Foo3 {
var numVal; var numVal;
var numVal = otherNumVal; var numVal = otherNumVal;
var a; var a1;
var a; var a2;
var a; var a3;
var a; var a4;
var a; var a5;
var a; var a6;
var a; var a7;
var a; var a8;
var a; var a9;
var a; var a10;
var a; var a11;
var a; var a12;
var a; var a13;
var a = [1, 2, 3]; var a14 = [1, 2, 3];
a = class Foo {}; a13 = class Foo {};
a = class Foo extends Bar {}; a14 = class Foo extends Bar {};
class Foo4 {} class Foo4 {}
@ -117,7 +117,7 @@ class Foo8 {
} }
function foo(requiredParam, optParam) {} function foo19(requiredParam, optParam) {}
class Foo9 {} class Foo9 {}
@ -128,50 +128,49 @@ class Foo11 {
#prop2; #prop2;
} }
var x = 4; var x1 = 4;
class Array { class Array {
concat(items) {} concat(items) {}
} }
var x = fn; var x2 = fn;
var x = Y; var x3 = Y;
var x = Y; var x4 = Y;
var { var {
x x5
} = { } = {
x: "hello" x5: "hello"
}; };
var { var {
x x6
} = { } = {
x: "hello" x6: "hello"
}; };
var [x] = ["hello"]; var [x7] = ["hello"];
function foo({ function foo20({
x x
}) {} }) {}
function foo([x]) {} function foo21([x]) {}
function foo(...rest) {} function foo22(...rest) {}
(function (...rest) {}); (function (...rest) {});
(...rest) => rest; (...rest) => rest;
var a; var a15;
var a; var a16;
var a; var a17;
var a; var a18;
var a; var a19;
var a; var a20;
var identity; var identity1;
var identity; var identity2;
import type from "foo"; import type from "foo";
import type2, { foo3 } from "bar";
import { V1 } from "foo"; import { V1 } from "foo";
import { V4 } from "foo"; import { V4 } from "foo";
import 'foo'; import 'foo';

View File

@ -65,7 +65,7 @@ describe("arrow function conversion", () => {
_supercall(); _supercall();
() => _supercall(); () => _supercall();
`, `,
{ methodName: "constructor" }, { methodName: "constructor", extend: true },
); );
}); });