From 11a01552a40a0f0306e3c32b1684a78de42c5c60 Mon Sep 17 00:00:00 2001 From: James Long Date: Fri, 30 Dec 2016 00:01:44 -0500 Subject: [PATCH] Lots of bug fixes (will do smaller commits from now on) --- package.json | 2 +- src/fast-path.js | 7 +- src/printer.js | 156 +- tests/annot/__snapshots__/jsfmt.spec.js.snap | 26 +- .../any/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/annot2/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/any/__snapshots__/jsfmt.spec.js.snap | 12 +- tests/arith/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../arraylib/__snapshots__/jsfmt.spec.js.snap | 32 +- tests/arrays/__snapshots__/jsfmt.spec.js.snap | 18 +- tests/arrows/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 30 - tests/ast_tokens/foo.js | 15 - tests/ast_tokens/jsfmt.spec.js | 1 - tests/async/__snapshots__/jsfmt.spec.js.snap | 51 - tests/async/await_not_in_async.js | 6 - tests/async/await_not_in_async2.js | 6 - tests/async/await_not_in_async3.js | 6 - .../__snapshots__/jsfmt.spec.js.snap | 34 +- .../__snapshots__/jsfmt.spec.js.snap | 376 - tests/autocomplete/bar.js | 4 - tests/autocomplete/bool.js | 3 - tests/autocomplete/foo.js | 10 - tests/autocomplete/foo_parse_fail.js | 10 - tests/autocomplete/fun.js | 5 - tests/autocomplete/function_builtins.js | 5 - tests/autocomplete/generics.js | 7 - tests/autocomplete/if.js | 3 - tests/autocomplete/issue-1368.js | 22 - tests/autocomplete/jsx1.js | 8 - tests/autocomplete/jsx2.js | 8 - tests/autocomplete/num.js | 4 - tests/autocomplete/object_builtins.js | 5 - tests/autocomplete/optional.js | 5 - tests/autocomplete/override.js | 10 - tests/autocomplete/qux.js | 6 - tests/autocomplete/str.js | 3 - tests/autocomplete/this.js | 10 - tests/autocomplete/typeparams.js | 8 - tests/autocomplete/union.js | 11 - tests/binary/__snapshots__/jsfmt.spec.js.snap | 66 +- tests/bom/__snapshots__/jsfmt.spec.js.snap | 10 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/break/__snapshots__/jsfmt.spec.js.snap | 32 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 10 +- .../callable/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 10 - tests/check-contents/syntax_error.js | 3 - .../__snapshots__/jsfmt.spec.js.snap | 637 -- tests/class_fields/base_class.js | 72 - tests/class_fields/derived_class.js | 134 - tests/class_fields/generic_class.js | 31 - tests/class_fields/jsfmt.spec.js | 1 - tests/class_fields/scoping.js | 40 - .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 2 +- .../classes/__snapshots__/jsfmt.spec.js.snap | 2 +- .../commonjs/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 68 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 20 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../ignore/__snapshots__/jsfmt.spec.js.snap | 4 +- .../no_flow/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 2 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../coverage/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/date/__snapshots__/jsfmt.spec.js.snap | 36 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 14 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 270 +- .../__snapshots__/jsfmt.spec.js.snap | 2 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- .../__snapshots__/jsfmt.spec.js.snap | 30 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 14 +- tests/demo/2/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 35 +- tests/destructuring/destructuring_init.js | 5 - .../__snapshots__/jsfmt.spec.js.snap | 68 +- .../__snapshots__/jsfmt.spec.js.snap | 587 +- tests/dom/__snapshots__/jsfmt.spec.js.snap | 152 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- tests/encaps/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- tests/equals/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 330 +- .../__snapshots__/jsfmt.spec.js.snap | 62 +- .../__snapshots__/jsfmt.spec.js.snap | 14 +- .../__snapshots__/jsfmt.spec.js.snap | 20 - .../jsfmt.spec.js | 1 - .../test.js | 8 - .../__snapshots__/jsfmt.spec.js.snap | 19 - .../jsfmt.spec.js | 1 - .../test.js | 7 - .../__snapshots__/jsfmt.spec.js.snap | 19 - .../jsfmt.spec.js | 1 - .../test.js | 7 - .../__snapshots__/jsfmt.spec.js.snap | 19 - .../jsfmt.spec.js | 1 - .../test.js | 7 - .../__snapshots__/jsfmt.spec.js.snap | 24 - .../jsfmt.spec.js | 1 - tests/esproposal_decorators.ignore/test.js | 11 - .../__snapshots__/jsfmt.spec.js.snap | 24 - .../esproposal_decorators.warn/jsfmt.spec.js | 1 - tests/esproposal_decorators.warn/test.js | 11 - .../__snapshots__/jsfmt.spec.js.snap | 12 - .../esproposal_export_star_as.enable/test.js | 3 - .../__snapshots__/jsfmt.spec.js.snap | 12 - .../esproposal_export_star_as.ignore/test.js | 3 - .../__snapshots__/jsfmt.spec.js.snap | 11 - .../jsfmt.spec.js | 1 - tests/esproposal_export_star_as.warn/test.js | 3 - .../__snapshots__/jsfmt.spec.js.snap | 54 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 66 +- tests/fetch/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 115 - tests/find-refs/jsfmt.spec.js | 1 - tests/find-refs/locals.js | 58 - .../fixpoint/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/for/__snapshots__/jsfmt.spec.js.snap | 72 +- tests/forof/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 160 +- .../generics/__snapshots__/jsfmt.spec.js.snap | 12 +- .../get-def/__snapshots__/jsfmt.spec.js.snap | 16 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 32 +- .../__snapshots__/jsfmt.spec.js.snap | 70 +- .../__snapshots__/jsfmt.spec.js.snap | 92 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- .../indexer/__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 32 +- .../__snapshots__/jsfmt.spec.js.snap | 31 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/iter/__snapshots__/jsfmt.spec.js.snap | 16 +- .../iterable/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 52 +- .../__snapshots__/jsfmt.spec.js.snap | 54 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/keys/__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 28 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../libs/__snapshots__/jsfmt.spec.js.snap | 20 - tests/liberr/libs/parse_error.js | 10 - .../literal/__snapshots__/jsfmt.spec.js.snap | 48 +- tests/locals/__snapshots__/jsfmt.spec.js.snap | 66 +- .../logical/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/loners/__snapshots__/jsfmt.spec.js.snap | 2 +- .../__snapshots__/jsfmt.spec.js.snap | 2 +- tests/misc/__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../modules/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 34 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 176 +- .../assert/__snapshots__/jsfmt.spec.js.snap | 4 +- .../buffer/__snapshots__/jsfmt.spec.js.snap | 2 +- .../crypto/__snapshots__/jsfmt.spec.js.snap | 52 +- .../nullable/__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 2 +- .../__snapshots__/jsfmt.spec.js.snap | 54 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../objects/__snapshots__/jsfmt.spec.js.snap | 92 +- tests/objmap/__snapshots__/jsfmt.spec.js.snap | 4 +- .../optional/__snapshots__/jsfmt.spec.js.snap | 26 +- .../__snapshots__/jsfmt.spec.js.snap | 46 +- .../overload/__snapshots__/jsfmt.spec.js.snap | 52 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/parse/__snapshots__/jsfmt.spec.js.snap | 31 +- tests/parse/fail-flow-2.js | 4 - tests/parse/fail-flow.js | 3 - tests/parse/fail.js | 1 - tests/parse_error_haste/NoProvides.js | 9 - tests/parse_error_haste/ParseError.js | 6 - tests/parse_error_haste/Provides.js | 12 - tests/parse_error_haste/Unimported.js | 10 - .../__snapshots__/jsfmt.spec.js.snap | 105 - tests/parse_error_node/Imported.js | 9 - tests/parse_error_node/ParseError.js | 6 - tests/parse_error_node/Unimported.js | 10 - .../__snapshots__/jsfmt.spec.js.snap | 73 - tests/path/__snapshots__/jsfmt.spec.js.snap | 8 +- .../plsummit/__snapshots__/jsfmt.spec.js.snap | 20 +- tests/poly/__snapshots__/jsfmt.spec.js.snap | 14 +- .../decls/__snapshots__/jsfmt.spec.js.snap | 26 +- .../__snapshots__/jsfmt.spec.js.snap | 265 +- .../__snapshots__/jsfmt.spec.js.snap | 411 +- .../predicates-declared/sanity-conditional.js | 5 - .../__snapshots__/jsfmt.spec.js.snap | 261 +- .../__snapshots__/jsfmt.spec.js.snap | 190 +- tests/predicates-parsing/unsupported-0.js | 5 - tests/predicates-parsing/unsupported-1.js | 5 - tests/predicates-parsing/unsupported-2.js | 6 - .../private/__snapshots__/jsfmt.spec.js.snap | 4 +- .../promises/__snapshots__/jsfmt.spec.js.snap | 52 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- tests/react/__snapshots__/jsfmt.spec.js.snap | 114 +- .../__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 108 +- .../es6class-proptypes-callsite.js | 26 - .../es6class-proptypes-module.js | 15 - tests/rec/__snapshots__/jsfmt.spec.js.snap | 12 +- .../recheck/__snapshots__/jsfmt.spec.js.snap | 74 +- .../tmp1c/__snapshots__/jsfmt.spec.js.snap | 4 +- .../tmp2a/__snapshots__/jsfmt.spec.js.snap | 4 +- .../tmp2e/__snapshots__/jsfmt.spec.js.snap | 6 +- .../tmp3e/__snapshots__/jsfmt.spec.js.snap | 18 +- tests/record/__snapshots__/jsfmt.spec.js.snap | 18 +- tests/refi/__snapshots__/jsfmt.spec.js.snap | 590 +- .../__snapshots__/jsfmt.spec.js.snap | 66 +- tests/regexp/__snapshots__/jsfmt.spec.js.snap | 4 +- .../replace/__snapshots__/jsfmt.spec.js.snap | 4 +- .../require/__snapshots__/jsfmt.spec.js.snap | 48 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- tests/return/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 6 +- tests/sealed/__snapshots__/jsfmt.spec.js.snap | 18 +- .../__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/spread/__snapshots__/jsfmt.spec.js.snap | 17 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/strict/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 14 +- .../__snapshots__/jsfmt.spec.js.snap | 36 +- .../suppress/__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- tests/switch/__snapshots__/jsfmt.spec.js.snap | 84 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- tests/taint/__snapshots__/jsfmt.spec.js.snap | 20 +- .../template/__snapshots__/jsfmt.spec.js.snap | 24 +- tests/this/__snapshots__/jsfmt.spec.js.snap | 24 +- .../__snapshots__/jsfmt.spec.js.snap | 32 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 12 +- tests/throw/__snapshots__/jsfmt.spec.js.snap | 4 +- tests/traits/__snapshots__/jsfmt.spec.js.snap | 10 +- tests/try/__snapshots__/jsfmt.spec.js.snap | 72 +- tests/tuples/__snapshots__/jsfmt.spec.js.snap | 18 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 7966 ++++++++--------- .../__snapshots__/jsfmt.spec.js.snap | 6 +- .../__snapshots__/jsfmt.spec.js.snap | 6 +- .../__snapshots__/jsfmt.spec.js.snap | 58 +- .../__snapshots__/jsfmt.spec.js.snap | 40 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 8 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../libs/__snapshots__/jsfmt.spec.js.snap | 29 +- .../__snapshots__/jsfmt.spec.js.snap | 36 +- .../typecast/__snapshots__/jsfmt.spec.js.snap | 20 +- tests/typeof/__snapshots__/jsfmt.spec.js.snap | 28 +- tests/unary/__snapshots__/jsfmt.spec.js.snap | 36 +- .../__snapshots__/jsfmt.spec.js.snap | 16 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- .../__snapshots__/jsfmt.spec.js.snap | 1342 +-- tests/union/__snapshots__/jsfmt.spec.js.snap | 10 +- .../__snapshots__/jsfmt.spec.js.snap | 172 +- .../lib/__snapshots__/jsfmt.spec.js.snap | 12 +- .../__snapshots__/jsfmt.spec.js.snap | 4 +- tests/value/__snapshots__/jsfmt.spec.js.snap | 12 +- .../weakmode/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/while/__snapshots__/jsfmt.spec.js.snap | 8 +- tests/yield/__snapshots__/jsfmt.spec.js.snap | 25 - tests/yield/jsfmt.spec.js | 1 - tests/yield/yield_arrow_error.js | 3 - tests/yield/yield_arrow_error2.js | 3 - tests_config/run_spec.js | 10 +- 286 files changed, 8410 insertions(+), 10878 deletions(-) delete mode 100644 tests/ast_tokens/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/ast_tokens/foo.js delete mode 100644 tests/ast_tokens/jsfmt.spec.js delete mode 100644 tests/async/await_not_in_async.js delete mode 100644 tests/async/await_not_in_async2.js delete mode 100644 tests/async/await_not_in_async3.js delete mode 100644 tests/autocomplete/bar.js delete mode 100644 tests/autocomplete/bool.js delete mode 100644 tests/autocomplete/foo.js delete mode 100644 tests/autocomplete/foo_parse_fail.js delete mode 100644 tests/autocomplete/fun.js delete mode 100644 tests/autocomplete/function_builtins.js delete mode 100644 tests/autocomplete/generics.js delete mode 100644 tests/autocomplete/if.js delete mode 100644 tests/autocomplete/issue-1368.js delete mode 100644 tests/autocomplete/jsx1.js delete mode 100644 tests/autocomplete/jsx2.js delete mode 100644 tests/autocomplete/num.js delete mode 100644 tests/autocomplete/object_builtins.js delete mode 100644 tests/autocomplete/optional.js delete mode 100644 tests/autocomplete/override.js delete mode 100644 tests/autocomplete/qux.js delete mode 100644 tests/autocomplete/str.js delete mode 100644 tests/autocomplete/this.js delete mode 100644 tests/autocomplete/typeparams.js delete mode 100644 tests/autocomplete/union.js delete mode 100644 tests/check-contents/syntax_error.js delete mode 100644 tests/class_fields/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/class_fields/base_class.js delete mode 100644 tests/class_fields/derived_class.js delete mode 100644 tests/class_fields/generic_class.js delete mode 100644 tests/class_fields/jsfmt.spec.js delete mode 100644 tests/class_fields/scoping.js delete mode 100644 tests/destructuring/destructuring_init.js delete mode 100644 tests/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/esproposal_class_instance_fields.ignore/jsfmt.spec.js delete mode 100644 tests/esproposal_class_instance_fields.ignore/test.js delete mode 100644 tests/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/esproposal_class_instance_fields.warn/jsfmt.spec.js delete mode 100644 tests/esproposal_class_instance_fields.warn/test.js delete mode 100644 tests/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/esproposal_class_static_fields.ignore/jsfmt.spec.js delete mode 100644 tests/esproposal_class_static_fields.ignore/test.js delete mode 100644 tests/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/esproposal_class_static_fields.warn/jsfmt.spec.js delete mode 100644 tests/esproposal_class_static_fields.warn/test.js delete mode 100644 tests/esproposal_decorators.ignore/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/esproposal_decorators.ignore/jsfmt.spec.js delete mode 100644 tests/esproposal_decorators.ignore/test.js delete mode 100644 tests/esproposal_decorators.warn/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/esproposal_decorators.warn/jsfmt.spec.js delete mode 100644 tests/esproposal_decorators.warn/test.js delete mode 100644 tests/esproposal_export_star_as.enable/test.js delete mode 100644 tests/esproposal_export_star_as.ignore/test.js delete mode 100644 tests/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/esproposal_export_star_as.warn/jsfmt.spec.js delete mode 100644 tests/esproposal_export_star_as.warn/test.js delete mode 100644 tests/find-refs/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/find-refs/jsfmt.spec.js delete mode 100644 tests/find-refs/locals.js delete mode 100644 tests/liberr/libs/parse_error.js delete mode 100644 tests/parse/fail-flow-2.js delete mode 100644 tests/parse/fail-flow.js delete mode 100644 tests/parse/fail.js delete mode 100644 tests/parse_error_haste/NoProvides.js delete mode 100644 tests/parse_error_haste/ParseError.js delete mode 100644 tests/parse_error_haste/Provides.js delete mode 100644 tests/parse_error_haste/Unimported.js delete mode 100644 tests/parse_error_node/Imported.js delete mode 100644 tests/parse_error_node/ParseError.js delete mode 100644 tests/parse_error_node/Unimported.js delete mode 100644 tests/predicates-declared/sanity-conditional.js delete mode 100644 tests/predicates-parsing/unsupported-0.js delete mode 100644 tests/predicates-parsing/unsupported-1.js delete mode 100644 tests/predicates-parsing/unsupported-2.js delete mode 100644 tests/react_modules/es6class-proptypes-callsite.js delete mode 100644 tests/react_modules/es6class-proptypes-module.js delete mode 100644 tests/yield/__snapshots__/jsfmt.spec.js.snap delete mode 100644 tests/yield/jsfmt.spec.js delete mode 100644 tests/yield/yield_arrow_error.js delete mode 100644 tests/yield/yield_arrow_error2.js diff --git a/package.json b/package.json index 96b0dafea..cb34a73c6 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "jsfmt\\.spec\\.js$" ], "testPathIgnorePatterns": [ - "tests/predicates-" + "tests/new_react" ] } } diff --git a/src/fast-path.js b/src/fast-path.js index 8d631d74d..9bea93963 100644 --- a/src/fast-path.js +++ b/src/fast-path.js @@ -291,7 +291,12 @@ FPp.needsParens = function(assumeExpressionContext) { case "IntersectionTypeAnnotation": case "UnionTypeAnnotation": - return parent.type === "NullableTypeAnnotation"; + return parent.type === "NullableTypeAnnotation" || + parent.type === "IntersectionTypeAnnotation" || + parent.type === "UnionTypeAnnotation"; + + case "FunctionTypeAnnotation": + return parent.type === "UnionTypeAnnotation"; case "Literal": return parent.type === "MemberExpression" diff --git a/src/printer.js b/src/printer.js index 870638fc3..53fa9dd6f 100644 --- a/src/printer.js +++ b/src/printer.js @@ -315,6 +315,7 @@ function genericPrintNoParens(path, options, print) { case "Identifier": return concat([ n.name, + n.optional ? "?" : "", path.call(print, "typeAnnotation") ]); @@ -350,12 +351,13 @@ function genericPrintNoParens(path, options, print) { indent(options.tabWidth, concat([ softline, - printFunctionParams(path, options, print) + printFunctionParams(path, print) ])), softline, ")" ])), path.call(print, "returnType"), + path.call(print, "predicate"), " ", path.call(print, "body") ); @@ -382,7 +384,7 @@ function genericPrintNoParens(path, options, print) { } else { parts.push( "(", - printFunctionParams(path, options, print), + printFunctionParams(path, print), ")", path.call(print, "returnType") ); @@ -617,7 +619,7 @@ function genericPrintNoParens(path, options, print) { case "ObjectTypeAnnotation": var allowBreak = false; var isTypeAnnotation = n.type === "ObjectTypeAnnotation"; - var separator = options.flowObjectCommas ? "," : (isTypeAnnotation ? ";" : ","); + var separator = isTypeAnnotation ? ";" : ","; var fields = []; var leftBrace = n.exact ? "{|" : "{"; var rightBrace = n.exact ? "|}" : "}"; @@ -645,7 +647,7 @@ function genericPrintNoParens(path, options, print) { indent(options.tabWidth, concat([ line, - join(concat([",", line]), props) + join(concat([separator, line]), props) ])), line, rightBrace @@ -683,7 +685,8 @@ function genericPrintNoParens(path, options, print) { parts.push("static "); } - return concat([parts, printObjectMethod(path, options, print)]); + parts = parts.concat(printObjectMethod(path, options, print)); + return concat(parts); case "ObjectMethod": // Babel 6 return printObjectMethod(path, options, print); @@ -693,7 +696,7 @@ function genericPrintNoParens(path, options, print) { case "ArrayExpression": case "ArrayPattern": - return multilineGroup(concat([ + parts.push(multilineGroup(concat([ "[", indent(options.tabWidth, concat([ @@ -703,7 +706,12 @@ function genericPrintNoParens(path, options, print) { ])), line, "]" - ])); + ]))); + + if (n.typeAnnotation) + parts.push(path.call(print, "typeAnnotation")); + + return concat(parts); case "SequenceExpression": return join(", ", path.map(print, "expressions")); @@ -1175,34 +1183,7 @@ function genericPrintNoParens(path, options, print) { case "ClassDeclaration": case "ClassExpression": - parts.push("class"); - - if (n.id) { - parts.push( - " ", - path.call(print, "id"), - path.call(print, "typeParameters") - ); - } - - if (n.superClass) { - parts.push( - " extends ", - path.call(print, "superClass"), - path.call(print, "superTypeParameters") - ); - } - - if (n["implements"] && n['implements'].length > 0) { - parts.push( - " implements ", - fromString(", ").join(path.map(print, "implements")) - ); - } - - parts.push(" ", path.call(print, "body")); - - return concat(parts); + return concat(printClass(path, print)); case "TemplateElement": return join(literalline, n.value.raw.split("\n")); @@ -1271,7 +1252,7 @@ function genericPrintNoParens(path, options, print) { case "TupleTypeAnnotation": return concat([ "[", - concat(path.map(print, "types")), + join(", ", path.map(print, "types")), "]" ]); @@ -1302,12 +1283,7 @@ function genericPrintNoParens(path, options, print) { return "" + n.value; case "DeclareClass": - return printFlowDeclaration(path, [ - "class ", - path.call(print, "id"), - " ", - path.call(print, "body"), - ]); + return printFlowDeclaration(path, printClass(path, print)); case "DeclareFunction": return printFlowDeclaration(path, [ @@ -1328,6 +1304,7 @@ function genericPrintNoParens(path, options, print) { return printFlowDeclaration(path, [ "module.exports", path.call(print, "typeAnnotation"), + ";" ]); case "DeclareVariable": @@ -1351,34 +1328,34 @@ function genericPrintNoParens(path, options, print) { case "FunctionTypeAnnotation": // FunctionTypeAnnotation is ambiguous: - // declare function(a: B): void; OR + // declare function foo(a: B): void; OR // var A: (a: B) => void; var parent = path.getParentNode(0); var isArrowFunctionTypeAnnotation = !( + (!parent.variance && namedTypes.ObjectTypeProperty.check(parent)) || namedTypes.ObjectTypeCallProperty.check(parent) || - namedTypes.DeclareFunction.check(path.getParentNode(2)) + namedTypes.DeclareFunction.check(path.getParentNode(2)) ); - var needsColon = - isArrowFunctionTypeAnnotation && - !namedTypes.FunctionTypeParam.check(parent); - - if (needsColon) { + var needsColon = isArrowFunctionTypeAnnotation && namedTypes.TypeAnnotation.check(parent); + if(needsColon) { parts.push(": "); } + parts.push(path.call(print, "typeParameters")); parts.push( "(", - join(", ", path.map(print, "params")), + printFunctionParams(path, print), ")" ); // The returnType is not wrapped in a TypeAnnotation, so the colon // needs to be added separately. - if (n.returnType) { + if (n.returnType || n.predicate) { parts.push( isArrowFunctionTypeAnnotation ? " => " : ": ", - path.call(print, "returnType") + path.call(print, "returnType"), + path.call(print, "predicate") ); } @@ -1409,7 +1386,7 @@ function genericPrintNoParens(path, options, print) { " " ); - if (n["extends"]) { + if (n["extends"].length > 0) { parts.push( "extends ", join(", ", path.map(print, "extends")) @@ -1467,12 +1444,14 @@ function genericPrintNoParens(path, options, print) { var variance = n.variance === "plus" ? "+" : n.variance === "minus" ? "-" : ""; + var isFunction = !n.variance && n.value.type === "FunctionTypeAnnotation"; return concat([ + n.static ? "static " : "", variance, path.call(print, "key"), n.optional ? "?" : "", - ": ", + isFunction ? "" : ": ", path.call(print, "value") ]); @@ -1494,17 +1473,23 @@ function genericPrintNoParens(path, options, print) { return fromString("string", options); case "DeclareTypeAlias": - parts.push("declare "); + case "TypeAlias": { + const parent = path.getParentNode(1); + if(n.type === "DeclareTypeAlias" || + (parent && parent.type === "DeclareModule")) { + parts.push("declare "); + } - case "TypeAlias": - return concat([ + parts.push( "type ", path.call(print, "id"), path.call(print, "typeParameters"), " = ", path.call(print, "right"), ";" - ]); + ); + return concat(parts); + } case "TypeCastExpression": return concat([ @@ -1554,10 +1539,16 @@ function genericPrintNoParens(path, options, print) { return join(" | ", path.map(print, "types")); case "VoidTypeAnnotation": - return fromString("void", options); + return "void"; case "NullTypeAnnotation": - return fromString("null", options); + return "null"; + + case "InferredPredicate": + return ": %checks"; + + case "DeclaredPredicate": + return concat([": %checks(", path.call(print, "value"), ")"]); // Unhandled types below. If encountered, nodes of these types should // be either left alone or desugared into AST types that are fully @@ -1685,7 +1676,7 @@ function printMethod(path, options, print) { path.call(print, "value", "typeParameters"), "(", path.call(function(valuePath) { - return printFunctionParams(valuePath, options, print); + return printFunctionParams(valuePath, print); }, "value"), ")", path.call(print, "value", "returnType"), @@ -1725,10 +1716,10 @@ function printArgumentsList(path, options, print) { return multilineGroup(concat(["(", args, ")"])); } -function printFunctionParams(path, options, print) { +function printFunctionParams(path, print) { var fun = path.getValue(); - namedTypes.Function.assert(fun); + // namedTypes.Function.assert(fun); var printed = path.map(print, "params"); @@ -1772,7 +1763,7 @@ function printObjectMethod(path, options, print) { parts.push( "(", - printFunctionParams(path, options, print), + printFunctionParams(path, print), ")", path.call(print, "returnType"), " ", @@ -1837,6 +1828,43 @@ function printFlowDeclaration(path, parts) { return concat(parts); } +function printClass(path, print) { + const n = path.getValue(); + const parts = ["class"]; + + if (n.id) { + parts.push( + " ", + path.call(print, "id"), + path.call(print, "typeParameters") + ); + } + + if (n.superClass) { + parts.push( + " extends ", + path.call(print, "superClass"), + path.call(print, "superTypeParameters") + ); + } + else if (n.extends && n.extends.length > 0) { + parts.push( + " extends ", + join(", ", path.map(print, "extends")) + ); + } + + if (n["implements"] && n['implements'].length > 0) { + parts.push( + " implements ", + fromString(", ").join(path.map(print, "implements")) + ); + } + + parts.push(" ", path.call(print, "body")); + return parts; +} + function adjustClause(clause, options) { if(getFirstString(clause) === "{") { return concat([" ", clause]); diff --git a/tests/annot/__snapshots__/jsfmt.spec.js.snap b/tests/annot/__snapshots__/jsfmt.spec.js.snap index 026be1a62..4054561fb 100644 --- a/tests/annot/__snapshots__/jsfmt.spec.js.snap +++ b/tests/annot/__snapshots__/jsfmt.spec.js.snap @@ -77,7 +77,7 @@ var bar: (str: number, i: number) => string = foo; var qux = function(str: string, i: number): number { return foo(str, i); }; -var obj: { str: string, i: number, j: boolean } = { +var obj: { str: string; i: number; j: boolean } = { str: \"...\", i: \"...\", k: false @@ -89,15 +89,15 @@ var matrix_parens: number[][] = matrix; var nullable_array: ?number[] = null; var nullable_array_parens: ?number[] = nullable_array; var array_of_nullable: ?number[] = [ null, 3 ]; -var array_of_tuple: [numberstring][] = [ [ 0, \"foo\" ], [ 1, \"bar\" ] ]; -var array_of_tuple_parens: [numberstring][] = array_of_tuple; -type ObjType = { \"bar-foo\": string, \"foo-bar\": number }; +var array_of_tuple: [number, string][] = [ [ 0, \"foo\" ], [ 1, \"bar\" ] ]; +var array_of_tuple_parens: [number, string][] = array_of_tuple; +type ObjType = { \"bar-foo\": string; \"foo-bar\": number }; var test_obj: ObjType = { \"bar-foo\": \"23\" }; function param_anno(n: number): void { n = \"hey\"; } function param_anno2( - batchRequests: Array<{ method: string, path: string, params: ?Object }> + batchRequests: Array<{ method: string; path: string; params: ?Object }> ): void { batchRequests = batchRequests.map( request => { @@ -249,16 +249,16 @@ class Foo { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // hypothetical immutable map -type Merge = : (a: T, b: T) => T; -declare class Map { - (): Map, - insertWith: : (fn: Merge, k: K, v: V) => Map +type Merge = (a: T, b: T) => T; +declare class Map { + (): Map; + insertWith(fn: Merge, k: K, v: V): Map } -declare function foldr(fn: (a: A, b: B) => B, b: B, as: A[]): B; +declare function foldr(fn: (a: A, b: B) => B, b: B, as: A[]): B; function insertMany( - merge: Merge, vs: [KV][], m: Map + merge: Merge, vs: [K, V][], m: Map ): Map { - function f([ k, v ], m: Map): Map { + function f([ k, v ]: [K, V], m: Map): Map { return m.insertWith(merge, k, v); } return foldr(f, m, vs); @@ -266,7 +266,7 @@ function insertMany( class Foo { bar() { return function(a: A, b: B, c: C): void { - ([ a, b, c ]: [ABC]); + ([ a, b, c ]: [A, B, C]); }; } } diff --git a/tests/annot/any/__snapshots__/jsfmt.spec.js.snap b/tests/annot/any/__snapshots__/jsfmt.spec.js.snap index f6070a87c..90450e20d 100644 --- a/tests/annot/any/__snapshots__/jsfmt.spec.js.snap +++ b/tests/annot/any/__snapshots__/jsfmt.spec.js.snap @@ -20,14 +20,14 @@ export default class { `; exports[`test B.js 1`] = ` -"import A from \"./A\" +"import A from "./A" class B extends A { p: string; // OK, string ~> any } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // OK, string ~> any -import A from \"./A\"; +import A from "./A"; class B extends A { p: string; } diff --git a/tests/annot2/__snapshots__/jsfmt.spec.js.snap b/tests/annot2/__snapshots__/jsfmt.spec.js.snap index ad5e53c3c..a640ad3f7 100644 --- a/tests/annot2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/annot2/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`test A.js 1`] = ` * @flow */ -import type T from \"T\"; +import type T from "T"; export default class { p: T; @@ -18,7 +18,7 @@ export default class { * @providesModule A * @flow */ -import type T from \"T\"; +import type T from "T"; export default class { p: T; constructor() { @@ -33,7 +33,7 @@ exports[`test B.js 1`] = ` * @flow */ -import A from \"A\" +import A from "A" class B extends A { p: string; // OK, string ~> any @@ -43,7 +43,7 @@ class B extends A { * @flow */ // OK, string ~> any -import A from \"A\"; +import A from "A"; class B extends A { p: string; } diff --git a/tests/any/__snapshots__/jsfmt.spec.js.snap b/tests/any/__snapshots__/jsfmt.spec.js.snap index 231023a25..66cd8a8ff 100644 --- a/tests/any/__snapshots__/jsfmt.spec.js.snap +++ b/tests/any/__snapshots__/jsfmt.spec.js.snap @@ -156,14 +156,14 @@ function foo(c: C, x: any): string { return c.bar(0, y); // should be able to select first case and error } -var any_fun1 = require(\'./nonflowfile\'); +var any_fun1 = require('./nonflowfile'); function bar1(x: mixed) { if (any_fun1(x)) { (x: boolean); } } -var any_fun2 = require(\'./anyexportflowfile\'); +var any_fun2 = require('./anyexportflowfile'); function bar2(x: mixed) { if (any_fun2(x)) { (x: boolean); @@ -173,20 +173,20 @@ function bar2(x: mixed) { // @flow // should be able to select first case and error declare class C { - bar: : (n1: number, n2: number) => number, - bar: : (s1: string, s2: string) => string + bar(n1: number, n2: number): number; + bar(s1: string, s2: string): string } function foo(c: C, x: any): string { let y = x.y; return c.bar(0, y); } -var any_fun1 = require(\"./nonflowfile\"); +var any_fun1 = require("./nonflowfile"); function bar1(x: mixed) { if (any_fun1(x)) { (x: boolean); } } -var any_fun2 = require(\"./anyexportflowfile\"); +var any_fun2 = require("./anyexportflowfile"); function bar2(x: mixed) { if (any_fun2(x)) { (x: boolean); diff --git a/tests/arith/__snapshots__/jsfmt.spec.js.snap b/tests/arith/__snapshots__/jsfmt.spec.js.snap index 9861a051c..fab391ae2 100644 --- a/tests/arith/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arith/__snapshots__/jsfmt.spec.js.snap @@ -154,16 +154,16 @@ function bar0(x: ?number, y: number) { function bar1(x: number, y: ?number) { num(x + y); } -function bar2(x: number, y: number) { +function bar2(x?: number, y: number) { num(x + y); } -function bar3(x: number, y: number) { +function bar3(x: number, y?: number) { num(x + y); } -function bar4(x: ?number, y: number) { +function bar4(x?: ?number, y: number) { num(x + y); } -function bar5(x: number, y: ?number) { +function bar5(x: number, y?: ?number) { num(x + y); } num(null + null); diff --git a/tests/array-filter/__snapshots__/jsfmt.spec.js.snap b/tests/array-filter/__snapshots__/jsfmt.spec.js.snap index 7a5765780..9967d8241 100644 --- a/tests/array-filter/__snapshots__/jsfmt.spec.js.snap +++ b/tests/array-filter/__snapshots__/jsfmt.spec.js.snap @@ -24,7 +24,7 @@ exports[`test test2.js 1`] = ` function filterItems(items: Array): Array { return items.map(item => { - if (typeof item === \'string\') { + if (typeof item === 'string') { return item.length > 2 ? item : null; } else { return item*10; @@ -32,7 +32,7 @@ function filterItems(items: Array): Array { }).filter(Boolean); } -const filteredItems = filterItems([\'foo\', \'b\', 1, 2]); +const filteredItems = filterItems(['foo', 'b', 1, 2]); console.log(filteredItems); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -40,7 +40,7 @@ console.log(filteredItems); function filterItems(items: Array): Array { return items.map( item => { - if (typeof item === \"string\") { + if (typeof item === "string") { return (item.length > 2 ? item : null); } else { return item * 10; @@ -48,7 +48,7 @@ function filterItems(items: Array): Array { } ).filter(Boolean); } -const filteredItems = filterItems([ \"foo\", \"b\", 1, 2 ]); +const filteredItems = filterItems([ "foo", "b", 1, 2 ]); console.log(filteredItems); " `; diff --git a/tests/array_spread/__snapshots__/jsfmt.spec.js.snap b/tests/array_spread/__snapshots__/jsfmt.spec.js.snap index c902ddba4..6f6190485 100644 --- a/tests/array_spread/__snapshots__/jsfmt.spec.js.snap +++ b/tests/array_spread/__snapshots__/jsfmt.spec.js.snap @@ -5,15 +5,15 @@ var C = [1,2,3]; B.sort((a, b) => a - b); C.sort((a, b) => a - b); -var x: Array = [\'1\', \'2\']; -var y: Array = [\'3\', ...x]; +var x: Array = ['1', '2']; +var y: Array = ['3', ...x]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var A = [ 1, 2, 3 ]; var B = [ ...A ]; var C = [ 1, 2, 3 ]; B.sort((a, b) => a - b); C.sort((a, b) => a - b); -var x: Array = [ \"1\", \"2\" ]; -var y: Array = [ \"3\", ...x ]; +var x: Array = [ "1", "2" ]; +var y: Array = [ "3", ...x ]; " `; diff --git a/tests/arraylib/__snapshots__/jsfmt.spec.js.snap b/tests/arraylib/__snapshots__/jsfmt.spec.js.snap index 317c40ecd..3a9390d28 100644 --- a/tests/arraylib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arraylib/__snapshots__/jsfmt.spec.js.snap @@ -3,23 +3,23 @@ exports[`test array_lib.js 1`] = ` function foo(x:string) { } var a = [0]; -var b = a.map(function (x) { foo(x); return \"\" + x; }); +var b = a.map(function (x) { foo(x); return "" + x; }); var c: number = a[0]; var d: number = b[0]; var e:Array = a.reverse(); -var f = [\"\"]; +var f = [""]; var g:number = f.map(function () { return 0; })[0]; var h: Array = [1,2,3]; -var i: Array = [\'a\', \'b\', \'c\']; +var i: Array = ['a', 'b', 'c']; var j: Array = h.concat(i); var k: Array = h.concat(h); var l: Array = h.concat(1,2,3); -var m: Array = h.concat(\'a\', \'b\', \'c\'); -var n: Array = h.concat(\'a\', \'b\', \'c\'); // Error +var m: Array = h.concat('a', 'b', 'c'); +var n: Array = h.concat('a', 'b', 'c'); // Error function reduce_test() { /* Adapted from the following source: @@ -44,13 +44,13 @@ function reduce_test() { /* Added later, because the above is insufficient */ // acc is element type of array when no init is provided - [\"\"].reduce((acc, str) => acc * str.length); // error, string ~> number - [\"\"].reduceRight((acc, str) => acc * str.length); // error, string ~> number + [""].reduce((acc, str) => acc * str.length); // error, string ~> number + [""].reduceRight((acc, str) => acc * str.length); // error, string ~> number } function from_test() { var a: Array = Array.from([1, 2, 3], function(val, index) { - return index % 2 ? \"foo\" : String(val); + return index % 2 ? "foo" : String(val); }); var b: Array = Array.from([1, 2, 3], function(val) { return String(val); @@ -73,25 +73,25 @@ var a = [ 0 ]; var b = a.map( function(x) { foo(x); - return \"\" + x; + return "" + x; } ); var c: number = a[0]; var d: number = b[0]; var e: Array = a.reverse(); -var f = [ \"\" ]; +var f = [ "" ]; var g: number = f.map( function() { return 0; } )[0]; var h: Array = [ 1, 2, 3 ]; -var i: Array = [ \"a\", \"b\", \"c\" ]; +var i: Array = [ "a", "b", "c" ]; var j: Array = h.concat(i); var k: Array = h.concat(h); var l: Array = h.concat(1, 2, 3); -var m: Array = h.concat(\"a\", \"b\", \"c\"); -var n: Array = h.concat(\"a\", \"b\", \"c\"); +var m: Array = h.concat("a", "b", "c"); +var n: Array = h.concat("a", "b", "c"); function reduce_test() { [ 0, 1, 2, 3, 4 ].reduce( function(previousValue, currentValue, index, array) { @@ -114,14 +114,14 @@ function reduce_test() { return a.concat(b); } ); - [ \"\" ].reduce((acc, str) => acc * str.length); - [ \"\" ].reduceRight((acc, str) => acc * str.length); + [ "" ].reduce((acc, str) => acc * str.length); + [ "" ].reduceRight((acc, str) => acc * str.length); } function from_test() { var a: Array = Array.from( [ 1, 2, 3 ], function(val, index) { - return (index % 2 ? \"foo\" : String(val)); + return (index % 2 ? "foo" : String(val)); } ); var b: Array = Array.from( diff --git a/tests/arrays/__snapshots__/jsfmt.spec.js.snap b/tests/arrays/__snapshots__/jsfmt.spec.js.snap index 2db1ced7f..710bc7a84 100644 --- a/tests/arrays/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrays/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ function foo(x:string) { } var a = []; a[0] = 1; -a[1] = \"...\"; +a[1] = "..."; foo(a[1]); var y; @@ -32,12 +32,12 @@ var abig2: Array<{x:number; y:number}> = [ {x:0, y:0}, {x:0, y:0}, {x:0, y:0, a:true}, - {x:0, y:0, b:\"hey\"}, + {x:0, y:0, b:"hey"}, {x:0, y:0, c:1}, - {x:0, y:0, c:\"hey\"} + {x:0, y:0, c:"hey"} ]; -module.exports = \"arrays\"; +module.exports = "arrays"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Arrays */ // for literals, composite element type is union of individuals @@ -47,13 +47,13 @@ function foo(x: string) { } var a = [ ]; a[0] = 1; -a[1] = \"...\"; +a[1] = "..."; foo(a[1]); var y; a.forEach(x => y = x); var alittle: Array = [ 0, 1, 2, 3, null ]; var abig: Array = [ 0, 1, 2, 3, 4, 5, 6, 8, null ]; -var abig2: Array<{ x: number, y: number }> = [ +var abig2: Array<{ x: number; y: number }> = [ { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, @@ -68,11 +68,11 @@ var abig2: Array<{ x: number, y: number }> = [ { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0, a: true }, - { x: 0, y: 0, b: \"hey\" }, + { x: 0, y: 0, b: "hey" }, { x: 0, y: 0, c: 1 }, - { x: 0, y: 0, c: \"hey\" } + { x: 0, y: 0, c: "hey" } ]; -module.exports = \"arrays\"; +module.exports = "arrays"; " `; diff --git a/tests/arrows/__snapshots__/jsfmt.spec.js.snap b/tests/arrows/__snapshots__/jsfmt.spec.js.snap index 471ce5275..090563315 100644 --- a/tests/arrows/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arrows/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ var bad = (x: number): string => x; // Error! var ident = (x: T): T => x; (ident(1): number); -(ident(\"hi\"): number); // Error +(ident("hi"): number); // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -20,7 +20,7 @@ var add = (x: number, y: number): number => x + y; var bad = (x: number): string => x; var ident = (x: T): T => x; (ident(1): number); -(ident(\"hi\"): number); +(ident("hi"): number); " `; @@ -31,7 +31,7 @@ exports[`test arrows.js 1`] = ` ): Image { var maxPixelWidth = maxWidth; //images = images.sort(function (a, b) { return a.width - b.width }); - images = images.sort((a, b) => (a.width - b.width) + \"\"); + images = images.sort((a, b) => (a.width - b.width) + ""); return images.find(image => image.width >= maxPixelWidth) || images[images.length - 1]; } @@ -41,7 +41,7 @@ function selectBestEffortImageForWidth( maxWidth: number, images: Array ): Image { var maxPixelWidth = maxWidth; - images = images.sort((a, b) => a.width - b.width + \"\"); + images = images.sort((a, b) => a.width - b.width + ""); return images.find(image => image.width >= maxPixelWidth) || images[images.length - 1]; } diff --git a/tests/ast_tokens/__snapshots__/jsfmt.spec.js.snap b/tests/ast_tokens/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 3a4ee8758..000000000 --- a/tests/ast_tokens/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,30 +0,0 @@ -exports[`test foo.js 1`] = ` -"// Regex literals require a lexer mode change -/asdf/g; - -// JSX also requires a lexer mode change -
asdf
; - -// Async arrow functions require backtracking -var a = async () => 42; - -// Type annotations have a special lex mode -var a: number = 42; - -// Token stream should continue even with parse errors -var var -a; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* Regex literals require a lexer mode change*/ -/* JSX also requires a lexer mode change*/ -// Async arrow functions require backtracking -// Type annotations have a special lex mode -// Token stream should continue even with parse errors -/asdf/g; -
asdf
; -var a = async () => 42; -var a: number = 42; -var var; -a; -" -`; diff --git a/tests/ast_tokens/foo.js b/tests/ast_tokens/foo.js deleted file mode 100644 index cca10855f..000000000 --- a/tests/ast_tokens/foo.js +++ /dev/null @@ -1,15 +0,0 @@ -// Regex literals require a lexer mode change -/asdf/g; - -// JSX also requires a lexer mode change -
asdf
; - -// Async arrow functions require backtracking -var a = async () => 42; - -// Type annotations have a special lex mode -var a: number = 42; - -// Token stream should continue even with parse errors -var var -a; diff --git a/tests/ast_tokens/jsfmt.spec.js b/tests/ast_tokens/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/ast_tokens/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/async/__snapshots__/jsfmt.spec.js.snap b/tests/async/__snapshots__/jsfmt.spec.js.snap index 6b8b87ee8..3cd1397c9 100644 --- a/tests/async/__snapshots__/jsfmt.spec.js.snap +++ b/tests/async/__snapshots__/jsfmt.spec.js.snap @@ -438,57 +438,6 @@ async function baz() { " `; -exports[`test await_not_in_async.js 1`] = ` -"// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. - -function f() { - await 1; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. -function f() { - await; - 1; -} -" -`; - -exports[`test await_not_in_async2.js 1`] = ` -"// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. - -function f(x) { return x; } - -f(await 1); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. -function f(x) { - return x; -} -f(await); -" -`; - -exports[`test await_not_in_async3.js 1`] = ` -"// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. - -async function f(x) { return x; } - -f(await 1); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. -async function f(x) { - return x; -} -f(await); -" -`; - exports[`test await_parse.js 1`] = ` "async function f() { await 1; } async function ft(a: T) { await 1; } diff --git a/tests/async/await_not_in_async.js b/tests/async/await_not_in_async.js deleted file mode 100644 index cbcc4191a..000000000 --- a/tests/async/await_not_in_async.js +++ /dev/null @@ -1,6 +0,0 @@ -// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. - -function f() { - await 1; -} diff --git a/tests/async/await_not_in_async2.js b/tests/async/await_not_in_async2.js deleted file mode 100644 index 0037d0905..000000000 --- a/tests/async/await_not_in_async2.js +++ /dev/null @@ -1,6 +0,0 @@ -// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. - -function f(x) { return x; } - -f(await 1); diff --git a/tests/async/await_not_in_async3.js b/tests/async/await_not_in_async3.js deleted file mode 100644 index cacb5dc67..000000000 --- a/tests/async/await_not_in_async3.js +++ /dev/null @@ -1,6 +0,0 @@ -// note: currently, await-within-async enforcement is a -// done by the parser, which bails after a single error. - -async function f(x) { return x; } - -f(await 1); diff --git a/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap b/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap index 93ed6d077..eb4a019d4 100644 --- a/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap +++ b/tests/async_iteration/__snapshots__/jsfmt.spec.js.snap @@ -78,17 +78,13 @@ async function* readLines(path) { } async function f() { - for await (const line of readLines(\"/path/to/file\")) { + for await (const line of readLines("/path/to/file")) { (line: void); // error: string ~> void } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error: string ~> void -interface File extends { - readLine: : () => Promise, - close: : () => void, - EOF: boolean -} +interface File { readLine(): Promise; close(): void; EOF: boolean } declare function fileOpen(path: string): Promise; async function* readLines(path) { let file: File = await fileOpen(path); @@ -101,7 +97,7 @@ async function* readLines(path) { } } async function f() { - for await (const line of readLines(\"/path/to/file\")) { + for await (const line of readLines("/path/to/file")) { (line: void); } } @@ -111,13 +107,13 @@ async function f() { exports[`test return.js 1`] = ` "declare var gen: AsyncGenerator; -// You can pass whatever you like to return, it doesn\'t need to be related to -// the AsyncGenerator\'s return type +// You can pass whatever you like to return, it doesn't need to be related to +// the AsyncGenerator's return type gen.return(0).then(result => { (result.value: void); // error: string | number ~> void }); -// However, a generator can \"refuse\" the return by catching an exception and +// However, a generator can "refuse" the return by catching an exception and // yielding or returning internally. async function *refuse_return() { try { @@ -126,16 +122,16 @@ async function *refuse_return() { return 0; } } -refuse_return().return(\"string\").then(result => { +refuse_return().return("string").then(result => { if (result.done) { (result.value: string); // error: number | void ~> string } }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// You can pass whatever you like to return, it doesn\'t need to be related to -// the AsyncGenerator\'s return type +// You can pass whatever you like to return, it doesn't need to be related to +// the AsyncGenerator's return type // error: string | number ~> void -// However, a generator can \"refuse\" the return by catching an exception and +// However, a generator can "refuse" the return by catching an exception and // yielding or returning internally. // error: number | void ~> string declare var gen: AsyncGenerator; @@ -151,7 +147,7 @@ async function* refuse_return() { return 0; } } -refuse_return().return(\"string\").then( +refuse_return().return("string").then( result => { if (result.done) { (result.value: string); @@ -171,7 +167,7 @@ exports[`test throw.js 1`] = ` } (async () => { - catch_return().throw(\"\").then(({value}) => { + catch_return().throw("").then(({value}) => { if (value !== undefined) { (value: void); // error: number ~> void } @@ -188,7 +184,7 @@ async function *yield_return() { } (async () => { - yield_return().throw(\"\").then(({value}) => { + yield_return().throw("").then(({value}) => { if (value !== undefined) { (value: void); // error: number ~> void } @@ -205,7 +201,7 @@ async function* catch_return() { } } async () => { - catch_return().throw(\"\").then( + catch_return().throw("").then( ({ value }) => { if (value !== undefined) { (value: void); @@ -222,7 +218,7 @@ async function* yield_return() { } } async () => { - yield_return().throw(\"\").then( + yield_return().throw("").then( ({ value }) => { if (value !== undefined) { (value: void); diff --git a/tests/autocomplete/__snapshots__/jsfmt.spec.js.snap b/tests/autocomplete/__snapshots__/jsfmt.spec.js.snap index 7e65beae2..c39735c8e 100644 --- a/tests/autocomplete/__snapshots__/jsfmt.spec.js.snap +++ b/tests/autocomplete/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,3 @@ -exports[`test bar.js 1`] = ` -"// @flow - -var o = require(\'./unknown\'); -o.x. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -var o = require(\"./unknown\"); -o.x.; -" -`; - -exports[`test bool.js 1`] = ` -"// @flow - -true. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -true.; -" -`; - exports[`test customfun.js 1`] = ` "// @flow @@ -45,360 +23,6 @@ m; " `; -exports[`test foo.js 1`] = ` -"/** - * @flow - */ - -var obj = { - num: 123, - str: \'hello\', -}; - -obj. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * @flow - */ -var obj = { num: 123, str: \"hello\" }; -obj.; -" -`; - -exports[`test foo_parse_fail.js 1`] = ` -"/** - * @flow - */ - -var obj = { - num: 123, - str: \'hello\', -}; - -console.log(obj. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * @flow - */ -var obj = { num: 123, str: \"hello\" }; -console.log(obj.); -" -`; - -exports[`test fun.js 1`] = ` -"/* @flow */ - -function foo(f: () => number) { - f. -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -function foo(f: () => number) { - f.}; -} -" -`; - -exports[`test function_builtins.js 1`] = ` -"/* @flow */ - -function foo(f: Function) { - f. -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -function foo(f: Function) { - f.}; -} -" -`; - -exports[`test generics.js 1`] = ` -"// @flow - -class C { } - -function foo(o: { cn: C }) { - o. -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -class C {} -function foo(o: { cn: C }) { - o.}; -} -" -`; - -exports[`test if.js 1`] = ` -"// @flow -const x = \'\'; -if (x.) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -const x = \"\"; -if (x.)) - -" -`; - -exports[`test issue-1368.js 1`] = ` -"/* @flow */ -class Test { - prop: number; - - constructor(prop: number) { - this.prop = prop; - } -} - -class ExtendTest extends Test { - extended: string; - - constructor(extended: string) { - super(10); - this.extended = extended; - } - - method() { - this.prop = 12; - this./* here */ - } -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -/* here */ -class Test { - prop: number; - constructor(prop: number) { - this.prop = prop; - } -} -class ExtendTest extends Test { - extended: string; - constructor(extended: string) { - super(10); - this.extended = extended; - } - method() { - this.prop = 12; - this.}; - } -} -" -`; - -exports[`test jsx1.js 1`] = ` -"// @flow - -var React = require(\'react\'); - -class C extends React.Component { - props: { x: number }; -} -; -" -`; - -exports[`test jsx2.js 1`] = ` -"// @flow - -var React = require(\'react\'); - -class C extends React.Component { - props: { x: number, y: string }; -} -; -" -`; - -exports[`test num.js 1`] = ` -"// @flow - -var num = 123; -num. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -var num = 123; -num.; -" -`; - -exports[`test object_builtins.js 1`] = ` -"/* @flow */ - -function foo(o: Object) { - o. -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -function foo(o: Object) { - o.}; -} -" -`; - -exports[`test optional.js 1`] = ` -"// @flow - -function foo(obj: { x?: string, f: (x?: string) => void, o: { x?: string } }) { - return obj. -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -function foo( - obj: { x?: string, f: : (x?: string) => void, o: { x?: string } } -) { - return obj.}; -} -" -`; - -exports[`test override.js 1`] = ` -"// @flow - -class C { - override(): number | string { return 0; } -} - -class D extends C { - foo() { return this.override() } - override(): string { return \"\"; } - bar() { this. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -class C { - override(): number | string { - return 0; - } -} -class D extends C { - foo() { - return this.override(); - } - override(): string { - return \"\"; - } - bar() { - this.; - } -} -" -`; - -exports[`test qux.js 1`] = ` -"// @flow - -class C { x: number; } - -var c: C = new C; -c. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -class C { - x: number; -} -var c: C = new C(); -c.; -" -`; - -exports[`test str.js 1`] = ` -"// @flow - -\"hello\". -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -\"hello\".; -" -`; - -exports[`test this.js 1`] = ` -"/* @flow */ - -// issue #1197 -class Foo { - baz: string; - bar() {} - hello() { - this. - } -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -// issue #1197 -class Foo { - baz: string; - bar() { - - } - hello() { - this.}; - } -} -" -`; - -exports[`test typeparams.js 1`] = ` -"// @flow - -class Bounds N> { - foo: F; - bar() { - this.foo(). - } -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -class Bounds N> { - foo: F; - bar() { - this.foo().}; - } -} -" -`; - -exports[`test union.js 1`] = ` -"/* @flow */ - -function foo(a: boolean, x: { bar: string }, y: Object) { - var z; - if (a) { - z = x; - } else { - z = y; - } - z. -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -function foo(a: boolean, x: { bar: string }, y: Object) { - var z; - if (a) { - z = x; - } else { - z = y; - } - z.}; -} -" -`; - exports[`test unknown.js 1`] = ` "// @noflow module.exports = { x: { y: \"\" } }; diff --git a/tests/autocomplete/bar.js b/tests/autocomplete/bar.js deleted file mode 100644 index 00c2758f2..000000000 --- a/tests/autocomplete/bar.js +++ /dev/null @@ -1,4 +0,0 @@ -// @flow - -var o = require('./unknown'); -o.x. diff --git a/tests/autocomplete/bool.js b/tests/autocomplete/bool.js deleted file mode 100644 index 31e0aa053..000000000 --- a/tests/autocomplete/bool.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow - -true. diff --git a/tests/autocomplete/foo.js b/tests/autocomplete/foo.js deleted file mode 100644 index fb47a498b..000000000 --- a/tests/autocomplete/foo.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @flow - */ - -var obj = { - num: 123, - str: 'hello', -}; - -obj. diff --git a/tests/autocomplete/foo_parse_fail.js b/tests/autocomplete/foo_parse_fail.js deleted file mode 100644 index ad60a9899..000000000 --- a/tests/autocomplete/foo_parse_fail.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @flow - */ - -var obj = { - num: 123, - str: 'hello', -}; - -console.log(obj. diff --git a/tests/autocomplete/fun.js b/tests/autocomplete/fun.js deleted file mode 100644 index dda5e9788..000000000 --- a/tests/autocomplete/fun.js +++ /dev/null @@ -1,5 +0,0 @@ -/* @flow */ - -function foo(f: () => number) { - f. -} diff --git a/tests/autocomplete/function_builtins.js b/tests/autocomplete/function_builtins.js deleted file mode 100644 index 9ab9ee978..000000000 --- a/tests/autocomplete/function_builtins.js +++ /dev/null @@ -1,5 +0,0 @@ -/* @flow */ - -function foo(f: Function) { - f. -} diff --git a/tests/autocomplete/generics.js b/tests/autocomplete/generics.js deleted file mode 100644 index 284ca1a8b..000000000 --- a/tests/autocomplete/generics.js +++ /dev/null @@ -1,7 +0,0 @@ -// @flow - -class C { } - -function foo(o: { cn: C }) { - o. -} diff --git a/tests/autocomplete/if.js b/tests/autocomplete/if.js deleted file mode 100644 index 78fb463ed..000000000 --- a/tests/autocomplete/if.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow -const x = ''; -if (x.) diff --git a/tests/autocomplete/issue-1368.js b/tests/autocomplete/issue-1368.js deleted file mode 100644 index fc346f45a..000000000 --- a/tests/autocomplete/issue-1368.js +++ /dev/null @@ -1,22 +0,0 @@ -/* @flow */ -class Test { - prop: number; - - constructor(prop: number) { - this.prop = prop; - } -} - -class ExtendTest extends Test { - extended: string; - - constructor(extended: string) { - super(10); - this.extended = extended; - } - - method() { - this.prop = 12; - this./* here */ - } -} diff --git a/tests/autocomplete/jsx1.js b/tests/autocomplete/jsx1.js deleted file mode 100644 index 4552fc4f0..000000000 --- a/tests/autocomplete/jsx1.js +++ /dev/null @@ -1,8 +0,0 @@ -// @flow - -var React = require('react'); - -class C extends React.Component { - props: { x: number }; -} - void, o: { x?: string } }) { - return obj. -} diff --git a/tests/autocomplete/override.js b/tests/autocomplete/override.js deleted file mode 100644 index 6b2e3dae5..000000000 --- a/tests/autocomplete/override.js +++ /dev/null @@ -1,10 +0,0 @@ -// @flow - -class C { - override(): number | string { return 0; } -} - -class D extends C { - foo() { return this.override() } - override(): string { return ""; } - bar() { this. diff --git a/tests/autocomplete/qux.js b/tests/autocomplete/qux.js deleted file mode 100644 index e25242a8a..000000000 --- a/tests/autocomplete/qux.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow - -class C { x: number; } - -var c: C = new C; -c. diff --git a/tests/autocomplete/str.js b/tests/autocomplete/str.js deleted file mode 100644 index 66e25873d..000000000 --- a/tests/autocomplete/str.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow - -"hello". diff --git a/tests/autocomplete/this.js b/tests/autocomplete/this.js deleted file mode 100644 index 8fb80158b..000000000 --- a/tests/autocomplete/this.js +++ /dev/null @@ -1,10 +0,0 @@ -/* @flow */ - -// issue #1197 -class Foo { - baz: string; - bar() {} - hello() { - this. - } -} diff --git a/tests/autocomplete/typeparams.js b/tests/autocomplete/typeparams.js deleted file mode 100644 index 7231f4c71..000000000 --- a/tests/autocomplete/typeparams.js +++ /dev/null @@ -1,8 +0,0 @@ -// @flow - -class Bounds N> { - foo: F; - bar() { - this.foo(). - } -} diff --git a/tests/autocomplete/union.js b/tests/autocomplete/union.js deleted file mode 100644 index ddf493f96..000000000 --- a/tests/autocomplete/union.js +++ /dev/null @@ -1,11 +0,0 @@ -/* @flow */ - -function foo(a: boolean, x: { bar: string }, y: Object) { - var z; - if (a) { - z = x; - } else { - z = y; - } - z. -} diff --git a/tests/binary/__snapshots__/jsfmt.spec.js.snap b/tests/binary/__snapshots__/jsfmt.spec.js.snap index 419e0de15..cdb4ff028 100644 --- a/tests/binary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/binary/__snapshots__/jsfmt.spec.js.snap @@ -4,31 +4,31 @@ exports[`test in.js 1`] = ` let tests = [ // objects on RHS function() { - (\'foo\' in {}); - (\'foo\' in { foo: null }); + ('foo' in {}); + ('foo' in { foo: null }); (0 in {}); - (0 in { \"0\": null }); + (0 in { "0": null }); }, // arrays on RHS function() { - (\'foo\' in []); + ('foo' in []); (0 in []); - (\'length\' in []); + ('length' in []); }, // primitive classes on RHS function() { - (\'foo\' in new String(\'bar\')); - (\'foo\' in new Number(123)); + ('foo' in new String('bar')); + ('foo' in new Number(123)); }, // primitives on RHS function() { - (\'foo\' in 123); // error - (\'foo\' in \'bar\'); // error - (\'foo\' in void 0); // error - (\'foo\' in null); // error + ('foo' in 123); // error + ('foo' in 'bar'); // error + ('foo' in void 0); // error + ('foo' in null); // error }, // bogus stuff on LHS @@ -42,15 +42,15 @@ let tests = [ // in predicates function() { - if (\'foo\' in 123) {} // error - if (!\'foo\' in {}) {} // error, !\'foo\' is a boolean - if (!(\'foo\' in {})) {} + if ('foo' in 123) {} // error + if (!'foo' in {}) {} // error, !'foo' is a boolean + if (!('foo' in {})) {} }, // annotations on RHS function(x: Object, y: mixed) { - (\'foo\' in x); // ok - (\'foo\' in y); // error + ('foo' in x); // ok + ('foo' in y); // error }, ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -71,31 +71,31 @@ let tests = [ // error // in predicates // error -// error, !\'foo\' is a boolean +// error, !'foo' is a boolean // annotations on RHS // ok // error let tests = [ function() { - \"foo\" in {}; - \"foo\" in { foo: null }; + "foo" in {}; + "foo" in { foo: null }; 0 in {}; - 0 in { \"0\": null }; + 0 in { "0": null }; }, function() { - \"foo\" in [ ]; + "foo" in [ ]; 0 in [ ]; - \"length\" in [ ]; + "length" in [ ]; }, function() { - \"foo\" in new String(\"bar\"); - \"foo\" in new Number(123); + "foo" in new String("bar"); + "foo" in new Number(123); }, function() { - \"foo\" in 123; - \"foo\" in \"bar\"; - \"foo\" in void 0; - \"foo\" in null; + "foo" in 123; + "foo" in "bar"; + "foo" in void 0; + "foo" in null; }, function() { null in {}; @@ -105,19 +105,19 @@ let tests = [ false in [ ]; }, function() { - if (\"foo\" in 123) { + if ("foo" in 123) { } - if (!\"foo\" in {}) { + if (!"foo" in {}) { } - if (!(\"foo\" in {})) { + if (!("foo" in {})) { } }, function(x: Object, y: mixed) { - \"foo\" in x; - \"foo\" in y; + "foo" in x; + "foo" in y; } ]; " diff --git a/tests/bom/__snapshots__/jsfmt.spec.js.snap b/tests/bom/__snapshots__/jsfmt.spec.js.snap index 24c0ab67a..c677fadcc 100644 --- a/tests/bom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/bom/__snapshots__/jsfmt.spec.js.snap @@ -173,19 +173,19 @@ for (let x: string | File of a.values()) { for (let x: string | File | Blob of a.values()) { } -for (let [ x, y ] of a.entries()) { +for (let [ x, y ]: [string, string | File] of a.entries()) { } -for (let [ x, y ] of a.entries()) { +for (let [ x, y ]: [string, string | File | Blob] of a.entries()) { } -for (let [ x, y ] of a.entries()) { +for (let [ x, y ]: [number, string] of a.entries()) { } -for (let [ x, y ] of a.entries()) { +for (let [ x, y ]: [string, number] of a.entries()) { } -for (let [ x, y ] of a.entries()) { +for (let [ x, y ]: [number, number] of a.entries()) { } " diff --git a/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap b/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap index 9da0e6398..d538915dd 100644 --- a/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap +++ b/tests/bounded_poly/__snapshots__/jsfmt.spec.js.snap @@ -1,13 +1,13 @@ exports[`test scope.js 1`] = ` "function foo(x:X, y:Y):void { } -foo(0, \"\"); +foo(0, ""); function bar(x:X, y:Y): number { return y*0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: X, y: Y): void { } -foo(0, \"\"); +foo(0, ""); function bar(x: X, y: Y): number { return y * 0; } @@ -33,7 +33,7 @@ class C { } function example(o: T): T { o.x = 0; return o; } -var obj1: {x: number; y: string} = example({x: 0, y: \"\"}); +var obj1: {x: number; y: string} = example({x: 0, y: ""}); var obj2: {x: number} = example({x: 0}); var c: C = new C; // error, since T = string is incompatible with number @@ -70,7 +70,7 @@ function example(o: T): T { o.x = 0; return o; } -var obj1: { x: number, y: string } = example({ x: 0, y: \"\" }); +var obj1: { x: number; y: string } = example({ x: 0, y: "" }); var obj2: { x: number } = example({ x: 0 }); var c: C = new C(); var q: number = c.qux(0); diff --git a/tests/break/__snapshots__/jsfmt.spec.js.snap b/tests/break/__snapshots__/jsfmt.spec.js.snap index 2822ad3a6..1d22b1b42 100644 --- a/tests/break/__snapshots__/jsfmt.spec.js.snap +++ b/tests/break/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test break.js 1`] = ` var x = b ? null: false; var z; while(b) { - if (x == null) { z = \"\"; break; } + if (x == null) { z = ""; break; } var y:number = x; // error: boolean !~> number } var w:number = z; // 2 errors: ?string !~> number @@ -12,10 +12,10 @@ exports[`test break.js 1`] = ` function bar(b) { var x = b ? null: false; if (x == null) return; - switch (\"\") { + switch ("") { case 0: var y:number = x; // error: boolean !~> number - x = \"\"; + x = ""; case 1: var z:number = x; // 2 errors: (boolean | string) !~> number break; @@ -27,10 +27,10 @@ function bar(b) { function bar2(b) { var x = b ? null: false; if (x == null) return; - switch (\"\") { + switch ("") { case 0: { let y:number = x; // error: boolean !~> number - x = \"\"; + x = ""; } case 1: { let z:number = x; // 2 errors: (boolean | string) !~> number @@ -45,7 +45,7 @@ function qux(b) { var z = 0; while(b) { var y:number = z; - if (b) { z = \"\"; continue; } // error: string !~> number + if (b) { z = ""; continue; } // error: string !~> number z = 0; } var w:number = z; // error: string !~> number @@ -54,10 +54,10 @@ function qux(b) { // same basic test as foo(), but with const. probes the // logic that still uses havoc to do env resets. function test_const() { - let st: string = \'abc\'; + let st: string = 'abc'; for (let i = 1; i < 100; i++) { - const fooRes: ?string = \"HEY\"; + const fooRes: ?string = "HEY"; if (!fooRes) { break; } @@ -86,7 +86,7 @@ function foo(b) { var z; while (b) { if (x == null) { - z = \"\"; + z = ""; break; } var y: number = x; @@ -97,10 +97,10 @@ function bar(b) { var x = (b ? null : false); if (x == null) return; - switch (\"\") { + switch ("") { case 0: var y: number = x; - x = \"\"; + x = ""; case 1: var z: number = x; break; @@ -112,11 +112,11 @@ function bar2(b) { var x = (b ? null : false); if (x == null) return; - switch (\"\") { + switch ("") { case 0: { let y: number = x; - x = \"\"; + x = ""; } case 1: { @@ -132,7 +132,7 @@ function qux(b) { while (b) { var y: number = z; if (b) { - z = \"\"; + z = ""; continue; } z = 0; @@ -140,9 +140,9 @@ function qux(b) { var w: number = z; } function test_const() { - let st: string = \"abc\"; + let st: string = "abc"; for (let i = 1; i < 100; i++) { - const fooRes: ?string = \"HEY\"; + const fooRes: ?string = "HEY"; if (!fooRes) { break; } diff --git a/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap b/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap index fead4428b..ec9d7cda0 100644 --- a/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap +++ b/tests/builtin_uses/__snapshots__/jsfmt.spec.js.snap @@ -10,10 +10,10 @@ module.exports = o; `; exports[`test test2.js 1`] = ` -"var o = require(\'./test\'); +"var o = require('./test'); (o.foo: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var o = require(\"./test\"); +var o = require("./test"); (o.foo: string); " `; diff --git a/tests/call_properties/__snapshots__/jsfmt.spec.js.snap b/tests/call_properties/__snapshots__/jsfmt.spec.js.snap index 28204a7a5..e73807653 100644 --- a/tests/call_properties/__snapshots__/jsfmt.spec.js.snap +++ b/tests/call_properties/__snapshots__/jsfmt.spec.js.snap @@ -216,19 +216,19 @@ function e(x: { (): string; (x: number): string }): () => number { // ...but should notice when a function doesn\'t satisfy them all // Only one call property needs to match the function // ...but you need at least one -function a(f: { (): string, (x: number): string }): string { +function a(f: { (): string; (x: number): string }): string { return f() + f(123); } -var b: { (): string, (x: number): string } = function(x: number): string { +var b: { (): string; (x: number): string } = function(x?: number): string { return \"hi\"; }; -var c: { (): string, (x: number): string } = function(x: number): string { +var c: { (): string; (x: number): string } = function(x: number): string { return \"hi\"; }; -function d(x: { (): string, (x: number): string }): () => string { +function d(x: { (): string; (x: number): string }): () => string { return x; } -function e(x: { (): string, (x: number): string }): () => number { +function e(x: { (): string; (x: number): string }): () => number { return x; } " diff --git a/tests/callable/__snapshots__/jsfmt.spec.js.snap b/tests/callable/__snapshots__/jsfmt.spec.js.snap index 455e1ff45..3dce571a0 100644 --- a/tests/callable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/callable/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ function f(x) { (f: F); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -type F = { (x: string): number, p?: string }; +type F = { (x: string): number; p?: string }; function f(x) { return x.length; } @@ -53,7 +53,7 @@ function foo(fn: (value: any) => boolean) { foo(Boolean); var dict: { [k: string]: any } = {}; dict(); -interface ICall extends { (x: string): void } +interface ICall { (x: string): void } declare var icall: ICall; icall(0); icall.call(null, 0); diff --git a/tests/check-contents/__snapshots__/jsfmt.spec.js.snap b/tests/check-contents/__snapshots__/jsfmt.spec.js.snap index b4414d351..0ad05acd5 100644 --- a/tests/check-contents/__snapshots__/jsfmt.spec.js.snap +++ b/tests/check-contents/__snapshots__/jsfmt.spec.js.snap @@ -4,13 +4,3 @@ exports[`test not_flow.js 1`] = ` 1 * \"foo\"; " `; - -exports[`test syntax_error.js 1`] = ` -"/* @flow */ - -( -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -null; -" -`; diff --git a/tests/check-contents/syntax_error.js b/tests/check-contents/syntax_error.js deleted file mode 100644 index 6ac6aff46..000000000 --- a/tests/check-contents/syntax_error.js +++ /dev/null @@ -1,3 +0,0 @@ -/* @flow */ - -( diff --git a/tests/class_fields/__snapshots__/jsfmt.spec.js.snap b/tests/class_fields/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 27c61b487..000000000 --- a/tests/class_fields/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,637 +0,0 @@ -exports[`test base_class.js 1`] = ` -"// @flow - -class Base { - unannotatedField; - annotatedField: number; - initializedField = 42; - initializedFieldWithThis = this.initializedField; - annotatedInitializedFieldValid: ?number = 42; - annotatedInitializedFieldInvalid: number = \'asdf\'; // Error: string ~> number - - static unannotatedField; - static annotatedField: number; - static initializedField = \'asdf\'; - static initializedFieldWithThis = this.initializedField; - static annotatedInitializedFieldValid: ?number = 42; - static annotatedInitializedFieldInvalid: number = \'asdf\'; // Error: string ~> number -} - -var o = new Base(); - -/** - * Unannotated fields are open. - */ -(o.unannotatedField: string); -(o.unannotatedField: number); -(Base.unannotatedField: string); -(Base.unannotatedField: number); - -/** - * Annotated (but uninitialized) fields still have a type. - */ -(o.annotatedField: number); -(o.annotatedField: string); // Error: number ~> string -(Base.annotatedField: number); -(Base.annotatedField: string); // Error: number ~> string - -/** - * Initialized (but unannotated) fields assume the type of their initializer. - */ -(o.initializedField: number); -(o.initializedField: string); // Error: number ~> string -(Base.initializedField: string); -(Base.initializedField: number); // Error: string ~> number - -/** - * Initialized fields can reference \`this\`. - */ -(o.initializedFieldWithThis: number); -(o.initializedFieldWithThis: string); // Error: number ~> string -(Base.initializedFieldWithThis: string); -(Base.initializedFieldWithThis: number); // Error: string ~> number - -/** - * Initialized + annotated fields take the type of the annotation. - * (Note that this matters when the annotation is more general than the type of - * the initializer) - */ -(o.annotatedInitializedFieldValid: ?number); -(o.annotatedInitializedFieldValid: number); // Error: ?number ~> number -(Base.annotatedInitializedFieldValid: ?number); -(Base.annotatedInitializedFieldValid: number); // Error: ?number ~> number - -/** - * Initialized + annotated fields where the init/annot combo is a mismatch - * should assume the type of the annotation. - * - * (This happens in addition to erroring at the site of initialization) - */ -(o.annotatedInitializedFieldInvalid: number); -(o.annotatedInitializedFieldInvalid: string); // Error: number ~> string -(Base.annotatedInitializedFieldInvalid: number); -(Base.annotatedInitializedFieldInvalid: string); // Error: number ~> string -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -// Error: string ~> number -// Error: string ~> number -/** - * Unannotated fields are open. - */ -/** - * Annotated (but uninitialized) fields still have a type. - */ -// Error: number ~> string -// Error: number ~> string -/** - * Initialized (but unannotated) fields assume the type of their initializer. - */ -// Error: number ~> string -// Error: string ~> number -/** - * Initialized fields can reference \`this\`. - */ -// Error: number ~> string -// Error: string ~> number -/** - * Initialized + annotated fields take the type of the annotation. - * (Note that this matters when the annotation is more general than the type of - * the initializer) - */ -// Error: ?number ~> number -// Error: ?number ~> number -/** - * Initialized + annotated fields where the init/annot combo is a mismatch - * should assume the type of the annotation. - * - * (This happens in addition to erroring at the site of initialization) - */ -// Error: number ~> string -// Error: number ~> string -class Base { - unannotatedField; - annotatedField: number; - initializedField; - =(;, - =, - ., - ;, - :, - =, - ;, - :, - =, - ;, - unannotatedField, - static, - :, - ;, - initializedField = \"asdf\", - static, - =, - ., - ;, - annotatedInitializedFieldValid: ?number = 42, - static, - :, - =, - ;, - var, - =, - Base) { - (o.unannotatedField: string); - (o.unannotatedField: number); - (Base.unannotatedField: string); - (Base.unannotatedField: number); - (o.annotatedField: number); - (o.annotatedField: string); - (Base.annotatedField: number); - (Base.annotatedField: string); - (o.initializedField: number); - (o.initializedField: string); - (Base.initializedField: string); - (Base.initializedField: number); - (o.initializedFieldWithThis: number); - (o.initializedFieldWithThis: string); - (Base.initializedFieldWithThis: string); - (Base.initializedFieldWithThis: number); - (o.annotatedInitializedFieldValid: ?number); - (o.annotatedInitializedFieldValid: number); - (Base.annotatedInitializedFieldValid: ?number); - (Base.annotatedInitializedFieldValid: number); - (o.annotatedInitializedFieldInvalid: number); - (o.annotatedInitializedFieldInvalid: string); - (Base.annotatedInitializedFieldInvalid: number); - (Base.annotatedInitializedFieldInvalid: string); - } -} -" -`; - -exports[`test derived_class.js 1`] = ` -"// @flow - -class Base { - base_unannotatedField; - base_annotatedField: number; - base_initializedField = 42; - base_initializedFieldWithThis = this.base_initializedField; - base_annotatedInitializedFieldValid: ?number = 42; - base_annotatedInitializedFieldInvalid: number = \'asdf\'; // Error: string ~> number - - static base_unannotatedField; - static base_annotatedField: number; - static base_initializedField = \'asdf\'; - static base_initializedFieldWithThis = this.base_initializedField; - static base_annotatedInitializedFieldValid: ?number = 42; - static base_annotatedInitializedFieldInvalid: number = \'asdf\'; // Error: string ~> number - - inherited_initializer = 42; - static inherited_initializer = 42; -} - -class Child extends Base { - child_unannotatedField; - child_annotatedField: number; - child_initializedField = 42; - child_initializedFieldWithThis = this.child_initializedField; - child_annotatedInitializedFieldValid: ?number = 42; - child_annotatedInitializedFieldInvalid: number = \'asdf\'; // Error: string ~> number - - static child_unannotatedField; - static child_annotatedField: number; - static child_initializedField = \'asdf\'; - static child_initializedFieldWithThis = this.child_initializedField; - static child_annotatedInitializedFieldValid: ?number = 42; - static child_annotatedInitializedFieldInvalid: number = \'asdf\'; // Error: string ~> number - - inherited_initializer; - static inherited_initializer; -} - -var o = new Child(); - -/** - * Unannotated fields are open. - */ -(o.base_unannotatedField: string); -(o.base_unannotatedField: number); -(Child.base_unannotatedField: string); -(Child.base_unannotatedField: number); - -(o.child_unannotatedField: string); -(o.child_unannotatedField: number); -(Child.child_unannotatedField: string); -(Child.child_unannotatedField: number); - - -/** - * Annotated (but uninitialized) fields still have a type. - */ -(o.base_annotatedField: number); -(o.base_annotatedField: string); // Error: number ~> string -(Child.base_annotatedField: number); -(Child.base_annotatedField: string); // Error: number ~> string - -(o.child_annotatedField: number); -(o.child_annotatedField: string); // Error: number ~> string -(Child.child_annotatedField: number); -(Child.child_annotatedField: string); // Error: number ~> string - -/** - * Initialized (but unannotated) fields assume the type of their initializer. - */ -(o.base_initializedField: number); -(o.base_initializedField: string); // Error: number ~> string -(Child.base_initializedField: string); -(Child.base_initializedField: number); // Error: string ~> number - -(o.child_initializedField: number); -(o.child_initializedField: string); // Error: number ~> string -(Child.child_initializedField: string); -(Child.child_initializedField: number); // Error: string ~> number - -/** - * Initialized fields can reference \`this\`. - */ -(o.base_initializedFieldWithThis: number); -(o.base_initializedFieldWithThis: string); // Error: number ~> string -(Child.base_initializedFieldWithThis: string); -(Child.base_initializedFieldWithThis: number); // Error: string ~> number - -(o.child_initializedFieldWithThis: number); -(o.child_initializedFieldWithThis: string); // Error: number ~> string -(Child.child_initializedFieldWithThis: string); -(Child.child_initializedFieldWithThis: number); // Error: string ~> number - -/** - * Initialized + annotated fields take the type of the annotation. - * (Note that this matters when the annotation is more general than the type of - * the initializer) - */ -(o.base_annotatedInitializedFieldValid: ?number); -(o.base_annotatedInitializedFieldValid: number); // Error: ?number ~> number -(Child.base_annotatedInitializedFieldValid: ?number); -(Child.base_annotatedInitializedFieldValid: number); // Error: ?number ~> number - -(o.child_annotatedInitializedFieldValid: ?number); -(o.child_annotatedInitializedFieldValid: number); // Error: ?number ~> number -(Child.child_annotatedInitializedFieldValid: ?number); -(Child.child_annotatedInitializedFieldValid: number); // Error: ?number ~> number - -/** - * Initialized + annotated fields where the init/annot combo is a mismatch - * should assume the type of the annotation. - * - * (This happens in addition to erroring at the site of initialization) - */ -(o.base_annotatedInitializedFieldInvalid: number); -(o.base_annotatedInitializedFieldInvalid: string); // Error: number ~> string -(Child.base_annotatedInitializedFieldInvalid: number); -(Child.base_annotatedInitializedFieldInvalid: string); // Error: number ~> string - -(o.child_annotatedInitializedFieldInvalid: number); -(o.child_annotatedInitializedFieldInvalid: string); // Error: number ~> string -(Child.child_annotatedInitializedFieldInvalid: number); -(Child.child_annotatedInitializedFieldInvalid: string); // Error: number ~> string - -/** - * Derived fields without an initializer that shadow base fields *with* an - * initializer should have the type of the base field. - */ -(o.inherited_initializer: number); -(o.inherited_initializer: string); // Error: number ~> string -(Child.inherited_initializer: number); -(Child.inherited_initializer: string); // Error: number ~> string -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -// Error: string ~> number -// Error: string ~> number -// Error: string ~> number -// Error: string ~> number -/** - * Unannotated fields are open. - */ -/** - * Annotated (but uninitialized) fields still have a type. - */ -// Error: number ~> string -// Error: number ~> string -// Error: number ~> string -// Error: number ~> string -/** - * Initialized (but unannotated) fields assume the type of their initializer. - */ -// Error: number ~> string -// Error: string ~> number -// Error: number ~> string -// Error: string ~> number -/** - * Initialized fields can reference \`this\`. - */ -// Error: number ~> string -// Error: string ~> number -// Error: number ~> string -// Error: string ~> number -/** - * Initialized + annotated fields take the type of the annotation. - * (Note that this matters when the annotation is more general than the type of - * the initializer) - */ -// Error: ?number ~> number -// Error: ?number ~> number -// Error: ?number ~> number -// Error: ?number ~> number -/** - * Initialized + annotated fields where the init/annot combo is a mismatch - * should assume the type of the annotation. - * - * (This happens in addition to erroring at the site of initialization) - */ -// Error: number ~> string -// Error: number ~> string -// Error: number ~> string -// Error: number ~> string -/** - * Derived fields without an initializer that shadow base fields *with* an - * initializer should have the type of the base field. - */ -// Error: number ~> string -// Error: number ~> string -class Base { - base_unannotatedField; - base_annotatedField: number; - base_initializedField; - =(;, - =, - ., - ;, - :, - =, - ;, - :, - =, - ;, - base_unannotatedField, - static, - :, - ;, - base_initializedField = \"asdf\", - static, - =, - ., - ;, - base_annotatedInitializedFieldValid: ?number = 42, - static, - :, - =, - ;, - =, - ;, - inherited_initializer = 42, - }, - Child, - Base, - child_unannotatedField, - child_annotatedField: number, - child_initializedField = 42, - child_initializedFieldWithThis = this.child_initializedField, - child_annotatedInitializedFieldValid: ?number = 42, - child_annotatedInitializedFieldInvalid: number = \"asdf\", - static, - ;, - child_annotatedField: number, - static, - =, - ;, - child_initializedFieldWithThis = this.child_initializedField, - static, - :, - =, - ;, - child_annotatedInitializedFieldInvalid: number = \"asdf\", - inherited_initializer, - static, - ;, - var, - =, - Child) { - (o.base_unannotatedField: string); - (o.base_unannotatedField: number); - (Child.base_unannotatedField: string); - (Child.base_unannotatedField: number); - (o.child_unannotatedField: string); - (o.child_unannotatedField: number); - (Child.child_unannotatedField: string); - (Child.child_unannotatedField: number); - (o.base_annotatedField: number); - (o.base_annotatedField: string); - (Child.base_annotatedField: number); - (Child.base_annotatedField: string); - (o.child_annotatedField: number); - (o.child_annotatedField: string); - (Child.child_annotatedField: number); - (Child.child_annotatedField: string); - (o.base_initializedField: number); - (o.base_initializedField: string); - (Child.base_initializedField: string); - (Child.base_initializedField: number); - (o.child_initializedField: number); - (o.child_initializedField: string); - (Child.child_initializedField: string); - (Child.child_initializedField: number); - (o.base_initializedFieldWithThis: number); - (o.base_initializedFieldWithThis: string); - (Child.base_initializedFieldWithThis: string); - (Child.base_initializedFieldWithThis: number); - (o.child_initializedFieldWithThis: number); - (o.child_initializedFieldWithThis: string); - (Child.child_initializedFieldWithThis: string); - (Child.child_initializedFieldWithThis: number); - (o.base_annotatedInitializedFieldValid: ?number); - (o.base_annotatedInitializedFieldValid: number); - (Child.base_annotatedInitializedFieldValid: ?number); - (Child.base_annotatedInitializedFieldValid: number); - (o.child_annotatedInitializedFieldValid: ?number); - (o.child_annotatedInitializedFieldValid: number); - (Child.child_annotatedInitializedFieldValid: ?number); - (Child.child_annotatedInitializedFieldValid: number); - (o.base_annotatedInitializedFieldInvalid: number); - (o.base_annotatedInitializedFieldInvalid: string); - (Child.base_annotatedInitializedFieldInvalid: number); - (Child.base_annotatedInitializedFieldInvalid: string); - (o.child_annotatedInitializedFieldInvalid: number); - (o.child_annotatedInitializedFieldInvalid: string); - (Child.child_annotatedInitializedFieldInvalid: number); - (Child.child_annotatedInitializedFieldInvalid: string); - (o.inherited_initializer: number); - (o.inherited_initializer: string); - (Child.inherited_initializer: number); - (Child.inherited_initializer: string); - } -} -" -`; - -exports[`test generic_class.js 1`] = ` -"// @flow - -/** - * Fields annotated with a generic should assume a type once the type param - * is instantiated. - */ -class ClassAnnotated { - p: T; - static p: T; -} - -var o1 = new ClassAnnotated(); -o1.p = 42; -(o1.p: number); -(o1.p: string); // Error: number ~> string -ClassAnnotated.p = 42; -(ClassAnnotated.p: number); -(ClassAnnotated.p: string); // Error: number ~> string - - -/** - * It\'s always an error to initialized a generically-typed field with an - * expression of any type other than the generic itself. - */ -class ClassGenericInitialized { - invalid: T = 42; // Error: number ~> Generic - valid: T = ((42:any):T); - - static invalid: T = 42; // Error: number ~> Generic - static valid: T = ((42:any):T); -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -/** - * Fields annotated with a generic should assume a type once the type param - * is instantiated. - */ -// Error: number ~> string -// Error: number ~> string -/** - * It\'s always an error to initialized a generically-typed field with an - * expression of any type other than the generic itself. - */ -// Error: number ~> Generic -// Error: number ~> Generic -class ClassAnnotated { - p: T; - static p: T; -} -var o1 = new ClassAnnotated(); -o1.p = 42; -(o1.p: number); -(o1.p: string); -ClassAnnotated.p = 42; -(ClassAnnotated.p: number); -(ClassAnnotated.p: string); -class ClassGenericInitialized { - invalid: T; - =(;, :, =, (, :): T { - static; - invalid: -T = 42; - static; - valid: -T = ((42: any): T); - } -} -" -`; - -exports[`test scoping.js 1`] = ` -"// @flow - -var someVar = 42; - -class Foo { - outer = someVar; - selfTyped: Foo; - selfTypedInit = new Foo(); - - static outer = someVar; - static selfTyped: Foo; - static selfTypedInit = new Foo(); - - constructor() { - var someVar = \'asdf\'; - } -} - -/** - * Field initializers execute in a scope immediately under the scope outside the - * class definition. - */ -(new Foo().outer: number); -(new Foo().outer: string); // Error: number ~> string -(Foo.outer: number); -(Foo.outer: string); // Error: number ~> string - -/** - * Field initializers should be able to refer to the class type in their type - * annotations. - */ -(new Foo().selfTyped: Foo); -(new Foo().selfTyped: number); // Error: Foo ~> number -(Foo.selfTyped: Foo); -(Foo.selfTyped: number); // Error: Foo ~> number - -(new Foo().selfTypedInit: Foo); -(new Foo().selfTypedInit: number); // Error: Foo ~> number -(Foo.selfTypedInit: Foo); -(Foo.selfTypedInit: number); // Error: Foo ~> number -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -/** - * Field initializers execute in a scope immediately under the scope outside the - * class definition. - */ -// Error: number ~> string -// Error: number ~> string -/** - * Field initializers should be able to refer to the class type in their type - * annotations. - */ -// Error: Foo ~> number -// Error: Foo ~> number -// Error: Foo ~> number -// Error: Foo ~> number -var someVar = 42; -class Foo { - outer; - =(;, :, ;, =, Foo) { - static; - outer = someVar; - static; - selfTyped: -Foo; - static; - selfTypedInit = new Foo(); - constructor(); - { - var someVar = \"asdf\"; - } - } - ((Foo) { - outer: -number; - (new Foo().outer: string); - (Foo.outer: number); - (Foo.outer: string); - (new Foo().selfTyped: Foo); - (new Foo().selfTyped: number); - (Foo.selfTyped: Foo); - (Foo.selfTyped: number); - (new Foo().selfTypedInit: Foo); - (new Foo().selfTypedInit: number); - (Foo.selfTypedInit: Foo); - (Foo.selfTypedInit: number); - } -} -" -`; diff --git a/tests/class_fields/base_class.js b/tests/class_fields/base_class.js deleted file mode 100644 index b5ad46bcc..000000000 --- a/tests/class_fields/base_class.js +++ /dev/null @@ -1,72 +0,0 @@ -// @flow - -class Base { - unannotatedField; - annotatedField: number; - initializedField = 42; - initializedFieldWithThis = this.initializedField; - annotatedInitializedFieldValid: ?number = 42; - annotatedInitializedFieldInvalid: number = 'asdf'; // Error: string ~> number - - static unannotatedField; - static annotatedField: number; - static initializedField = 'asdf'; - static initializedFieldWithThis = this.initializedField; - static annotatedInitializedFieldValid: ?number = 42; - static annotatedInitializedFieldInvalid: number = 'asdf'; // Error: string ~> number -} - -var o = new Base(); - -/** - * Unannotated fields are open. - */ -(o.unannotatedField: string); -(o.unannotatedField: number); -(Base.unannotatedField: string); -(Base.unannotatedField: number); - -/** - * Annotated (but uninitialized) fields still have a type. - */ -(o.annotatedField: number); -(o.annotatedField: string); // Error: number ~> string -(Base.annotatedField: number); -(Base.annotatedField: string); // Error: number ~> string - -/** - * Initialized (but unannotated) fields assume the type of their initializer. - */ -(o.initializedField: number); -(o.initializedField: string); // Error: number ~> string -(Base.initializedField: string); -(Base.initializedField: number); // Error: string ~> number - -/** - * Initialized fields can reference `this`. - */ -(o.initializedFieldWithThis: number); -(o.initializedFieldWithThis: string); // Error: number ~> string -(Base.initializedFieldWithThis: string); -(Base.initializedFieldWithThis: number); // Error: string ~> number - -/** - * Initialized + annotated fields take the type of the annotation. - * (Note that this matters when the annotation is more general than the type of - * the initializer) - */ -(o.annotatedInitializedFieldValid: ?number); -(o.annotatedInitializedFieldValid: number); // Error: ?number ~> number -(Base.annotatedInitializedFieldValid: ?number); -(Base.annotatedInitializedFieldValid: number); // Error: ?number ~> number - -/** - * Initialized + annotated fields where the init/annot combo is a mismatch - * should assume the type of the annotation. - * - * (This happens in addition to erroring at the site of initialization) - */ -(o.annotatedInitializedFieldInvalid: number); -(o.annotatedInitializedFieldInvalid: string); // Error: number ~> string -(Base.annotatedInitializedFieldInvalid: number); -(Base.annotatedInitializedFieldInvalid: string); // Error: number ~> string diff --git a/tests/class_fields/derived_class.js b/tests/class_fields/derived_class.js deleted file mode 100644 index 89b40c166..000000000 --- a/tests/class_fields/derived_class.js +++ /dev/null @@ -1,134 +0,0 @@ -// @flow - -class Base { - base_unannotatedField; - base_annotatedField: number; - base_initializedField = 42; - base_initializedFieldWithThis = this.base_initializedField; - base_annotatedInitializedFieldValid: ?number = 42; - base_annotatedInitializedFieldInvalid: number = 'asdf'; // Error: string ~> number - - static base_unannotatedField; - static base_annotatedField: number; - static base_initializedField = 'asdf'; - static base_initializedFieldWithThis = this.base_initializedField; - static base_annotatedInitializedFieldValid: ?number = 42; - static base_annotatedInitializedFieldInvalid: number = 'asdf'; // Error: string ~> number - - inherited_initializer = 42; - static inherited_initializer = 42; -} - -class Child extends Base { - child_unannotatedField; - child_annotatedField: number; - child_initializedField = 42; - child_initializedFieldWithThis = this.child_initializedField; - child_annotatedInitializedFieldValid: ?number = 42; - child_annotatedInitializedFieldInvalid: number = 'asdf'; // Error: string ~> number - - static child_unannotatedField; - static child_annotatedField: number; - static child_initializedField = 'asdf'; - static child_initializedFieldWithThis = this.child_initializedField; - static child_annotatedInitializedFieldValid: ?number = 42; - static child_annotatedInitializedFieldInvalid: number = 'asdf'; // Error: string ~> number - - inherited_initializer; - static inherited_initializer; -} - -var o = new Child(); - -/** - * Unannotated fields are open. - */ -(o.base_unannotatedField: string); -(o.base_unannotatedField: number); -(Child.base_unannotatedField: string); -(Child.base_unannotatedField: number); - -(o.child_unannotatedField: string); -(o.child_unannotatedField: number); -(Child.child_unannotatedField: string); -(Child.child_unannotatedField: number); - - -/** - * Annotated (but uninitialized) fields still have a type. - */ -(o.base_annotatedField: number); -(o.base_annotatedField: string); // Error: number ~> string -(Child.base_annotatedField: number); -(Child.base_annotatedField: string); // Error: number ~> string - -(o.child_annotatedField: number); -(o.child_annotatedField: string); // Error: number ~> string -(Child.child_annotatedField: number); -(Child.child_annotatedField: string); // Error: number ~> string - -/** - * Initialized (but unannotated) fields assume the type of their initializer. - */ -(o.base_initializedField: number); -(o.base_initializedField: string); // Error: number ~> string -(Child.base_initializedField: string); -(Child.base_initializedField: number); // Error: string ~> number - -(o.child_initializedField: number); -(o.child_initializedField: string); // Error: number ~> string -(Child.child_initializedField: string); -(Child.child_initializedField: number); // Error: string ~> number - -/** - * Initialized fields can reference `this`. - */ -(o.base_initializedFieldWithThis: number); -(o.base_initializedFieldWithThis: string); // Error: number ~> string -(Child.base_initializedFieldWithThis: string); -(Child.base_initializedFieldWithThis: number); // Error: string ~> number - -(o.child_initializedFieldWithThis: number); -(o.child_initializedFieldWithThis: string); // Error: number ~> string -(Child.child_initializedFieldWithThis: string); -(Child.child_initializedFieldWithThis: number); // Error: string ~> number - -/** - * Initialized + annotated fields take the type of the annotation. - * (Note that this matters when the annotation is more general than the type of - * the initializer) - */ -(o.base_annotatedInitializedFieldValid: ?number); -(o.base_annotatedInitializedFieldValid: number); // Error: ?number ~> number -(Child.base_annotatedInitializedFieldValid: ?number); -(Child.base_annotatedInitializedFieldValid: number); // Error: ?number ~> number - -(o.child_annotatedInitializedFieldValid: ?number); -(o.child_annotatedInitializedFieldValid: number); // Error: ?number ~> number -(Child.child_annotatedInitializedFieldValid: ?number); -(Child.child_annotatedInitializedFieldValid: number); // Error: ?number ~> number - -/** - * Initialized + annotated fields where the init/annot combo is a mismatch - * should assume the type of the annotation. - * - * (This happens in addition to erroring at the site of initialization) - */ -(o.base_annotatedInitializedFieldInvalid: number); -(o.base_annotatedInitializedFieldInvalid: string); // Error: number ~> string -(Child.base_annotatedInitializedFieldInvalid: number); -(Child.base_annotatedInitializedFieldInvalid: string); // Error: number ~> string - -(o.child_annotatedInitializedFieldInvalid: number); -(o.child_annotatedInitializedFieldInvalid: string); // Error: number ~> string -(Child.child_annotatedInitializedFieldInvalid: number); -(Child.child_annotatedInitializedFieldInvalid: string); // Error: number ~> string - -/** - * Derived fields without an initializer that shadow base fields *with* an - * initializer should have the type of the base field. - */ -(o.inherited_initializer: number); -(o.inherited_initializer: string); // Error: number ~> string -(Child.inherited_initializer: number); -(Child.inherited_initializer: string); // Error: number ~> string diff --git a/tests/class_fields/generic_class.js b/tests/class_fields/generic_class.js deleted file mode 100644 index d214ff6ce..000000000 --- a/tests/class_fields/generic_class.js +++ /dev/null @@ -1,31 +0,0 @@ -// @flow - -/** - * Fields annotated with a generic should assume a type once the type param - * is instantiated. - */ -class ClassAnnotated { - p: T; - static p: T; -} - -var o1 = new ClassAnnotated(); -o1.p = 42; -(o1.p: number); -(o1.p: string); // Error: number ~> string -ClassAnnotated.p = 42; -(ClassAnnotated.p: number); -(ClassAnnotated.p: string); // Error: number ~> string - - -/** - * It's always an error to initialized a generically-typed field with an - * expression of any type other than the generic itself. - */ -class ClassGenericInitialized { - invalid: T = 42; // Error: number ~> Generic - valid: T = ((42:any):T); - - static invalid: T = 42; // Error: number ~> Generic - static valid: T = ((42:any):T); -} diff --git a/tests/class_fields/jsfmt.spec.js b/tests/class_fields/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/class_fields/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/class_fields/scoping.js b/tests/class_fields/scoping.js deleted file mode 100644 index 462b51293..000000000 --- a/tests/class_fields/scoping.js +++ /dev/null @@ -1,40 +0,0 @@ -// @flow - -var someVar = 42; - -class Foo { - outer = someVar; - selfTyped: Foo; - selfTypedInit = new Foo(); - - static outer = someVar; - static selfTyped: Foo; - static selfTypedInit = new Foo(); - - constructor() { - var someVar = 'asdf'; - } -} - -/** - * Field initializers execute in a scope immediately under the scope outside the - * class definition. - */ -(new Foo().outer: number); -(new Foo().outer: string); // Error: number ~> string -(Foo.outer: number); -(Foo.outer: string); // Error: number ~> string - -/** - * Field initializers should be able to refer to the class type in their type - * annotations. - */ -(new Foo().selfTyped: Foo); -(new Foo().selfTyped: number); // Error: Foo ~> number -(Foo.selfTyped: Foo); -(Foo.selfTyped: number); // Error: Foo ~> number - -(new Foo().selfTypedInit: Foo); -(new Foo().selfTypedInit: number); // Error: Foo ~> number -(Foo.selfTypedInit: Foo); -(Foo.selfTypedInit: number); // Error: Foo ~> number diff --git a/tests/class_statics/__snapshots__/jsfmt.spec.js.snap b/tests/class_statics/__snapshots__/jsfmt.spec.js.snap index b495141d0..6f13f01aa 100644 --- a/tests/class_statics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_statics/__snapshots__/jsfmt.spec.js.snap @@ -12,9 +12,9 @@ class B extends A { static foo(x: string) { } // error? static main() { B.x = 0; // error - B.x = \"\"; + B.x = ""; B.foo(0); // error - B.foo(\"\"); + B.foo(""); B.y = 0; // error B.bar(0); // error B.qux(0); // error @@ -94,9 +94,9 @@ class B extends A { } static main() { B.x = 0; - B.x = \"\"; + B.x = ""; B.foo(0); - B.foo(\"\"); + B.foo(""); B.y = 0; B.bar(0); B.qux(0); diff --git a/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap b/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap index 960c0bc4c..7f195ceb6 100644 --- a/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_subtyping/__snapshots__/jsfmt.spec.js.snap @@ -14,7 +14,7 @@ module.exports = { A, B }; exports[`test test2.js 1`] = ` "/* @flow */ -var I = require(\"./test.js\"); +var I = require("./test.js"); class C extends I.A {} @@ -22,7 +22,7 @@ var x: I.A = new C(); var y: I.B = new C(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var I = require(\"./test.js\"); +var I = require("./test.js"); class C extends I.A {} var x: I.A = new C(); var y: I.B = new C(); diff --git a/tests/class_type/__snapshots__/jsfmt.spec.js.snap b/tests/class_type/__snapshots__/jsfmt.spec.js.snap index 7189cb7fd..2b60ee25b 100644 --- a/tests/class_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/class_type/__snapshots__/jsfmt.spec.js.snap @@ -47,7 +47,7 @@ check(B, new C); // A function to typecheck values against their types. Covariance of Class<.> // makes it useless in such a function (when limited to classes and instances), // since everything can be trivially satisfied by going to \`mixed\`. -declare function check(cls: $Type, inst: X): void; +declare function check(cls: $Type, inst: X): void; class A {} class B extends A {} class C {} diff --git a/tests/classes/__snapshots__/jsfmt.spec.js.snap b/tests/classes/__snapshots__/jsfmt.spec.js.snap index 5f572db36..99a428715 100644 --- a/tests/classes/__snapshots__/jsfmt.spec.js.snap +++ b/tests/classes/__snapshots__/jsfmt.spec.js.snap @@ -120,7 +120,7 @@ var w : Foo = z; // conflicts with cast to Foo // conflicts with cast to Foo // conflicts with cast to Foo -type Foo = { a: string, b: string, c?: ?string, d?: number }; +type Foo = { a: string; b: string; c?: ?string; d?: number }; class TestClass { a: string; c: ?string; diff --git a/tests/commonjs/__snapshots__/jsfmt.spec.js.snap b/tests/commonjs/__snapshots__/jsfmt.spec.js.snap index 4f261d586..527f81bdb 100644 --- a/tests/commonjs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/commonjs/__snapshots__/jsfmt.spec.js.snap @@ -13,11 +13,11 @@ module.exports = f; exports[`test Rel.js 1`] = ` " -var f = require(\'./Abs\'); +var f = require('./Abs'); f(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var f = require(\"./Abs\"); +var f = require("./Abs"); f(0); " `; diff --git a/tests/computed_props/__snapshots__/jsfmt.spec.js.snap b/tests/computed_props/__snapshots__/jsfmt.spec.js.snap index ce1cfa128..fa3e437cd 100644 --- a/tests/computed_props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/computed_props/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test test.js 1`] = ` "var ColorId = { - RED: \'R\', - GREEN: \'G\', - BLUE: \'B\', + RED: 'R', + GREEN: 'G', + BLUE: 'B', }; var ColorNumber = { - RED: \'ff0000\', - GREEN: \'00ff00\', - BLUE: \'0000ff\', + RED: 'ff0000', + GREEN: '00ff00', + BLUE: '0000ff', }; var ColorIdToNumber = { @@ -17,7 +17,7 @@ var ColorIdToNumber = { [ColorId.BLUE]: ColorNumber.BLUE, }; -(ColorIdToNumber[ColorId.RED]: \'ffffff\'); // oops +(ColorIdToNumber[ColorId.RED]: 'ffffff'); // oops ColorIdToNumber.XXX; // oops @@ -25,91 +25,91 @@ module.exports = { ColorId, ColorNumber }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops // oops -var ColorId = { RED: \"R\", GREEN: \"G\", BLUE: \"B\" }; -var ColorNumber = { RED: \"ff0000\", GREEN: \"00ff00\", BLUE: \"0000ff\" }; +var ColorId = { RED: "R", GREEN: "G", BLUE: "B" }; +var ColorNumber = { RED: "ff0000", GREEN: "00ff00", BLUE: "0000ff" }; var ColorIdToNumber = { [ColorId.RED]: ColorNumber.RED, [ColorId.GREEN]: ColorNumber.GREEN, [ColorId.BLUE]: ColorNumber.BLUE }; -(ColorIdToNumber[ColorId.RED]: \"ffffff\"); +(ColorIdToNumber[ColorId.RED]: "ffffff"); ColorIdToNumber.XXX; module.exports = { ColorId, ColorNumber }; " `; exports[`test test2.js 1`] = ` -"var { ColorId, ColorNumber } = require(\'./test\'); +"var { ColorId, ColorNumber } = require('./test'); var ColorIdToNumber = { [ColorId.RED]: ColorNumber.RED, [ColorId.GREEN]: ColorNumber.GREEN, [ColorId.BLUE]: ColorNumber.BLUE, }; -(ColorIdToNumber[ColorId.GREEN]: \'ffffff\'); // oops +(ColorIdToNumber[ColorId.GREEN]: 'ffffff'); // oops module.exports = ColorIdToNumber; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops -var { ColorId, ColorNumber } = require(\"./test\"); +var { ColorId, ColorNumber } = require("./test"); var ColorIdToNumber = { [ColorId.RED]: ColorNumber.RED, [ColorId.GREEN]: ColorNumber.GREEN, [ColorId.BLUE]: ColorNumber.BLUE }; -(ColorIdToNumber[ColorId.GREEN]: \"ffffff\"); +(ColorIdToNumber[ColorId.GREEN]: "ffffff"); module.exports = ColorIdToNumber; " `; exports[`test test3.js 1`] = ` -"var { ColorId } = require(\'./test\'); -var ColorIdToNumber = require(\'./test2\'); +"var { ColorId } = require('./test'); +var ColorIdToNumber = require('./test2'); -(ColorIdToNumber[ColorId.BLUE]: \'ffffff\'); // oops +(ColorIdToNumber[ColorId.BLUE]: 'ffffff'); // oops ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops -var { ColorId } = require(\"./test\"); -var ColorIdToNumber = require(\"./test2\"); -(ColorIdToNumber[ColorId.BLUE]: \"ffffff\"); +var { ColorId } = require("./test"); +var ColorIdToNumber = require("./test2"); +(ColorIdToNumber[ColorId.BLUE]: "ffffff"); " `; exports[`test test4.js 1`] = ` -"module.exports = \'hello\'; +"module.exports = 'hello'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -module.exports = \"hello\"; +module.exports = "hello"; " `; exports[`test test5.js 1`] = ` -"var hello = require(\'./test4\'); -var dummy = require(\'./test\'); +"var hello = require('./test4'); +var dummy = require('./test'); module.exports = { ...dummy, - [hello]: \'world\', + [hello]: 'world', ...dummy, }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var hello = require(\"./test4\"); -var dummy = require(\"./test\"); -module.exports = { ...dummy, [hello]: \"world\", ...dummy }; +var hello = require("./test4"); +var dummy = require("./test"); +module.exports = { ...dummy, [hello]: "world", ...dummy }; " `; exports[`test test6.js 1`] = ` -"var o = require(\'./test5\'); -(o.hello: \'nothing\'); // oops +"var o = require('./test5'); +(o.hello: 'nothing'); // oops ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // oops -var o = require(\"./test5\"); -(o.hello: \"nothing\"); +var o = require("./test5"); +(o.hello: "nothing"); " `; exports[`test test7.js 1`] = ` "var obj = {x: 0, m() { return this.x }} -var x: string = obj[\'m\'](); // error, number ~> string +var x: string = obj['m'](); // error, number ~> string var arr = [function() { return this.length }]; var y: string = arr[0](); // error: number ~> string @@ -122,7 +122,7 @@ var obj = { return this.x; } }; -var x: string = obj[\"m\"](); +var x: string = obj["m"](); var arr = [ function() { return this.length; diff --git a/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap b/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap index f00841185..c00070557 100644 --- a/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_file_extensions/__snapshots__/jsfmt.spec.js.snap @@ -4,21 +4,21 @@ exports[`test test.js 1`] = ` */ function foo(x) { - var a: number = \'asdf\'; + var a: number = 'asdf'; return x * 10; } // This file should be ignored, so this should not result in an error -foo(\'Hello, world!\'); +foo('Hello, world!'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * @flow */ // This file should be ignored, so this should not result in an error function foo(x) { - var a: number = \"asdf\"; + var a: number = "asdf"; return x * 10; } -foo(\"Hello, world!\"); +foo("Hello, world!"); " `; diff --git a/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap index aef90c394..4ac58abf2 100644 --- a/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_name_rewrite_haste/__snapshots__/jsfmt.spec.js.snap @@ -1,31 +1,31 @@ exports[`test A.js 1`] = ` "/* @flow */ -var m1 = require(\'1DoesntExist\'); -import {numVal as numVal1} from \'1DoesntExist\'; +var m1 = require('1DoesntExist'); +import {numVal as numVal1} from '1DoesntExist'; var a_1: number = m1.numVal; var a_2: number = numVal1; -// Error: \'Exists2\' is not a valid module name +// Error: 'Exists2' is not a valid module name // // This tests that, for haste, the first name_mapper regexp that happens to // match the given module name string is picked. -var m2 = require(\'2DoesntExist\'); // Error -import {numVal as numVal2} from \'3DoesntExist\'; // Error +var m2 = require('2DoesntExist'); // Error +import {numVal as numVal2} from '3DoesntExist'; // Error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -// Error: \'Exists2\' is not a valid module name +// Error: 'Exists2' is not a valid module name // // This tests that, for haste, the first name_mapper regexp that happens to // match the given module name string is picked. // Error // Error -var m1 = require(\"1DoesntExist\"); -import { numVal as numVal1 } from \"1DoesntExist\"; +var m1 = require("1DoesntExist"); +import { numVal as numVal1 } from "1DoesntExist"; var a_1: number = m1.numVal; var a_2: number = numVal1; -var m2 = require(\"2DoesntExist\"); -import { numVal as numVal2 } from \"3DoesntExist\"; +var m2 = require("2DoesntExist"); +import { numVal as numVal2 } from "3DoesntExist"; " `; diff --git a/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap b/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap index f7fd51887..988dd773a 100644 --- a/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_module_name_rewrite_node/__snapshots__/jsfmt.spec.js.snap @@ -1,27 +1,27 @@ exports[`test A.js 1`] = ` "/* @flow */ -var m1 = require(\'./1DoesntExist\'); +var m1 = require('./1DoesntExist'); var a_1: number = m1.numVal; var a_2: string = m1.numVal; // Error: number ~> string -import {numVal} from \'./1DoesntExist\'; +import {numVal} from './1DoesntExist'; var a_3: number = numVal; var a_4: string = numVal; // Error: number ~> string // This tests that, for node, the first name mapping that both matches *and* // results in a valid module filename is picked. -var m2 = require(\'./2DoesntExist\'); +var m2 = require('./2DoesntExist'); var b_1: number = m2.numVal; var b_2: string = m2.numVal; // Error: number ~> string -import {numVal as numVal2} from \'./3DoesntExist\'; +import {numVal as numVal2} from './3DoesntExist'; var b_3: number = numVal2; var b_4: string = numVal2; // Error: number ~> string // node_modules/Exists/index.js -var m3 = require(\'4DoesntExist\'); +var m3 = require('4DoesntExist'); var c_1: number = m3.numVal; var c_2: string = m3.numVal; // Error: number ~> string -import {numVal as numVal3} from \'5DoesntExist\'; +import {numVal as numVal3} from '5DoesntExist'; var c_3: number = numVal3; var c_4: string = numVal3; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -35,22 +35,22 @@ var c_4: string = numVal3; // Error: number ~> string // node_modules/Exists/index.js // Error: number ~> string // Error: number ~> string -var m1 = require(\"./1DoesntExist\"); +var m1 = require("./1DoesntExist"); var a_1: number = m1.numVal; var a_2: string = m1.numVal; -import { numVal } from \"./1DoesntExist\"; +import { numVal } from "./1DoesntExist"; var a_3: number = numVal; var a_4: string = numVal; -var m2 = require(\"./2DoesntExist\"); +var m2 = require("./2DoesntExist"); var b_1: number = m2.numVal; var b_2: string = m2.numVal; -import { numVal as numVal2 } from \"./3DoesntExist\"; +import { numVal as numVal2 } from "./3DoesntExist"; var b_3: number = numVal2; var b_4: string = numVal2; -var m3 = require(\"4DoesntExist\"); +var m3 = require("4DoesntExist"); var c_1: number = m3.numVal; var c_2: string = m3.numVal; -import { numVal as numVal3 } from \"5DoesntExist\"; +import { numVal as numVal3 } from "5DoesntExist"; var c_3: number = numVal3; var c_4: string = numVal3; " diff --git a/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap b/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap index 6476b1b37..7572be3da 100644 --- a/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_munging_underscores/__snapshots__/jsfmt.spec.js.snap @@ -12,7 +12,7 @@ class A { return 1; } static _sMethod(): string { - return \"some string\"; + return "some string"; } } A._sProperty = 48; @@ -23,16 +23,16 @@ class B extends A { constructor() { super(); - this._property1 = \"another string\"; + this._property1 = "another string"; } _method1(): string { - return \"yet another string\"; + return "yet another string"; } static _sMethod(): number { return 23; } } -B._sProperty = \"B._sProperty string\"; +B._sProperty = "B._sProperty string"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ class A { @@ -45,7 +45,7 @@ class A { return 1; } static _sMethod(): string { - return \"some string\"; + return "some string"; } } A._sProperty = 48; @@ -54,16 +54,16 @@ class B extends A { static _sProperty: string; constructor() { super(); - this._property1 = \"another string\"; + this._property1 = "another string"; } _method1(): string { - return \"yet another string\"; + return "yet another string"; } static _sMethod(): number { return 23; } } -B._sProperty = \"B._sProperty string\"; +B._sProperty = "B._sProperty string"; " `; @@ -87,9 +87,9 @@ module.exports = new C(); exports[`test commonjs_import.js 1`] = ` "/* @flow */ -import {_p} from \"./commonjs_export\"; +import {_p} from "./commonjs_export"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import { _p } from \"./commonjs_export\"; +import { _p } from "./commonjs_export"; " `; diff --git a/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap b/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap index 69d00c9cb..a9a086820 100644 --- a/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/config_munging_underscores2/__snapshots__/jsfmt.spec.js.snap @@ -12,7 +12,7 @@ class A { return 1; } static _sMethod(): string { - return \"some string\"; + return "some string"; } } A._sProperty = 48; @@ -23,16 +23,16 @@ class B extends A { constructor() { super(); - this._property1 = \"another string\"; + this._property1 = "another string"; } _method1(): string { - return \"yet another string\"; + return "yet another string"; } static _sMethod(): number { return 23; } } -B._sProperty = \"B._sProperty string\"; +B._sProperty = "B._sProperty string"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ class A { @@ -45,7 +45,7 @@ class A { return 1; } static _sMethod(): string { - return \"some string\"; + return "some string"; } } A._sProperty = 48; @@ -54,15 +54,15 @@ class B extends A { static _sProperty: string; constructor() { super(); - this._property1 = \"another string\"; + this._property1 = "another string"; } _method1(): string { - return \"yet another string\"; + return "yet another string"; } static _sMethod(): number { return 23; } } -B._sProperty = \"B._sProperty string\"; +B._sProperty = "B._sProperty string"; " `; diff --git a/tests/constructor_annots/__snapshots__/jsfmt.spec.js.snap b/tests/constructor_annots/__snapshots__/jsfmt.spec.js.snap index 87218609a..fb2dfccb2 100644 --- a/tests/constructor_annots/__snapshots__/jsfmt.spec.js.snap +++ b/tests/constructor_annots/__snapshots__/jsfmt.spec.js.snap @@ -39,8 +39,8 @@ Foo.prototype = { } }; exports.Foo = Foo; -interface IFooPrototype extends { m: : () => number } -interface IFoo extends IFooPrototype { (): void, x: boolean, y: boolean } +interface IFooPrototype { m(): number } +interface IFoo extends IFooPrototype { (): void; x: boolean; static y: boolean } exports.Foo2 = (Foo: Class); " `; diff --git a/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap b/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap index 199421819..860e520b7 100644 --- a/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/contents/ignore/__snapshots__/jsfmt.spec.js.snap @@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = ` `; exports[`test test.js 1`] = ` -"require(\'./dummy\'); +"require('./dummy'); var xxx = 0; xxx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\"./dummy\"); +require("./dummy"); var xxx = 0; xxx; " diff --git a/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap b/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap index 199421819..860e520b7 100644 --- a/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap +++ b/tests/contents/no_flow/__snapshots__/jsfmt.spec.js.snap @@ -5,11 +5,11 @@ exports[`test dummy.js 1`] = ` `; exports[`test test.js 1`] = ` -"require(\'./dummy\'); +"require('./dummy'); var xxx = 0; xxx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -require(\"./dummy\"); +require("./dummy"); var xxx = 0; xxx; " diff --git a/tests/core_tests/__snapshots__/jsfmt.spec.js.snap b/tests/core_tests/__snapshots__/jsfmt.spec.js.snap index 17619df04..7b43343fd 100644 --- a/tests/core_tests/__snapshots__/jsfmt.spec.js.snap +++ b/tests/core_tests/__snapshots__/jsfmt.spec.js.snap @@ -124,7 +124,7 @@ let tests = [ // get() // error, string | void // error, wrong key type -function* generator(): Iterable<[stringnumber]> { +function* generator(): Iterable<[string, number]> { while (true) { yield [ \"foo\", 123 ]; } diff --git a/tests/covariance/__snapshots__/jsfmt.spec.js.snap b/tests/covariance/__snapshots__/jsfmt.spec.js.snap index 64e1dc5b1..cf1405021 100644 --- a/tests/covariance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/covariance/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test test.js 1`] = ` "type CovArrayVerbose = Array; var b: CovArrayVerbose = []; var y: CovArrayVerbose = b; -y[0] = \"\"; // error +y[0] = ""; // error class NVerbose { x: CovArrayVerbose; @@ -22,12 +22,12 @@ var z: CovArray = c; // error var d: CovArray = []; var w: CovArray = d; -w[0] = \"\"; // error +w[0] = ""; // error type P = CovArray; var p: P = []; (p[0]: number); // not an error! -p[0] = \"\"; // error +p[0] = ""; // error class M { x: CovArray; @@ -60,12 +60,12 @@ var z: CovArray = c; // error var d: CovArray = []; var w: CovArray = d; -w[0] = \"\"; // error +w[0] = ""; // error type P = CovArray; var p: P = []; (p[0]: number); // not an error! -p[0] = \"\"; // error +p[0] = ""; // error class M { x: CovArray; @@ -89,7 +89,7 @@ n.x = [0]; type CovArrayVerbose = Array; var b: CovArrayVerbose = [ ]; var y: CovArrayVerbose = b; -y[0] = \"\"; +y[0] = ""; class NVerbose { x: CovArrayVerbose; foo(): CovArrayVerbose { diff --git a/tests/coverage/__snapshots__/jsfmt.spec.js.snap b/tests/coverage/__snapshots__/jsfmt.spec.js.snap index dbd0e8319..6be8b72ed 100644 --- a/tests/coverage/__snapshots__/jsfmt.spec.js.snap +++ b/tests/coverage/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test crash.js 1`] = ` -"// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" +"// This file triggers a violation of the "disjoint-or-nested ranges invariant" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes a crash with coverage --color. @@ -11,7 +11,7 @@ declare module bar { // TODO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" +// This file triggers a violation of the "disjoint-or-nested ranges invariant" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes a crash with coverage --color. // TODO @@ -47,7 +47,7 @@ let x = 0; `; exports[`test non-termination.js 1`] = ` -"// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" +"// This file triggers a violation of the "disjoint-or-nested ranges invariant" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes non-termination with coverage --color. @@ -62,7 +62,7 @@ declare module bar { declare class qux { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// This file triggers a violation of the \"disjoint-or-nested ranges invariant\" +// This file triggers a violation of the "disjoint-or-nested ranges invariant" // that we implicitly assume in type-at-pos and coverage implementations. In // particular, when unchecked it causes non-termination with coverage --color. // TODO diff --git a/tests/date/__snapshots__/jsfmt.spec.js.snap b/tests/date/__snapshots__/jsfmt.spec.js.snap index e4ac978bb..5d10c0bcf 100644 --- a/tests/date/__snapshots__/jsfmt.spec.js.snap +++ b/tests/date/__snapshots__/jsfmt.spec.js.snap @@ -7,7 +7,7 @@ var y:number = d; // valid constructors new Date(); new Date(1234567890); -new Date(\'2015/06/18\'); +new Date('2015/06/18'); new Date(2015, 6); new Date(2015, 6, 18); new Date(2015, 6, 18, 11); @@ -17,16 +17,16 @@ new Date(2015, 6, 18, 11, 55, 42, 999); // invalid constructors new Date({}); -new Date(2015, \'6\'); -new Date(2015, 6, \'18\'); -new Date(2015, 6, 18, \'11\'); -new Date(2015, 6, 18, 11, \'55\'); -new Date(2015, 6, 18, 11, 55, \'42\'); -new Date(2015, 6, 18, 11, 55, 42, \'999\'); +new Date(2015, '6'); +new Date(2015, 6, '18'); +new Date(2015, 6, 18, '11'); +new Date(2015, 6, 18, 11, '55'); +new Date(2015, 6, 18, 11, 55, '42'); +new Date(2015, 6, 18, 11, 55, 42, '999'); // invalid constructors that we incorrectly consider valid -new Date(\'2015\', 6); -new Date(2015, 6, 18, 11, 55, 42, 999, \'hahaha\'); +new Date('2015', 6); +new Date(2015, 6, 18, 11, 55, 42, 999, 'hahaha'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // valid constructors // invalid constructors @@ -36,7 +36,7 @@ var x: string = d.getTime(); var y: number = d; new Date(); new Date(1234567890); -new Date(\"2015/06/18\"); +new Date("2015/06/18"); new Date(2015, 6); new Date(2015, 6, 18); new Date(2015, 6, 18, 11); @@ -44,13 +44,13 @@ new Date(2015, 6, 18, 11, 55); new Date(2015, 6, 18, 11, 55, 42); new Date(2015, 6, 18, 11, 55, 42, 999); new Date({}); -new Date(2015, \"6\"); -new Date(2015, 6, \"18\"); -new Date(2015, 6, 18, \"11\"); -new Date(2015, 6, 18, 11, \"55\"); -new Date(2015, 6, 18, 11, 55, \"42\"); -new Date(2015, 6, 18, 11, 55, 42, \"999\"); -new Date(\"2015\", 6); -new Date(2015, 6, 18, 11, 55, 42, 999, \"hahaha\"); +new Date(2015, "6"); +new Date(2015, 6, "18"); +new Date(2015, 6, 18, "11"); +new Date(2015, 6, 18, 11, "55"); +new Date(2015, 6, 18, 11, 55, "42"); +new Date(2015, 6, 18, 11, 55, 42, "999"); +new Date("2015", 6); +new Date(2015, 6, 18, 11, 55, 42, 999, "hahaha"); " `; diff --git a/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap b/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap index 777cf1f1c..0fbbba77e 100644 --- a/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declaration_files_node/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ exports[`test A.js 1`] = ` "/* @flow */ -module.exports.fun = (): string => \'hello there!\'; +module.exports.fun = (): string => 'hello there!'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -module.exports.fun = (): string => \"hello there!\"; +module.exports.fun = (): string => "hello there!"; " `; @@ -21,23 +21,23 @@ exports[`test test_absolute.js 1`] = ` "/* @flow */ // This will require ./node_modules/B.js.flow -var B1 = require(\'B\'); +var B1 = require('B'); (B1.fun(): string); // Error number ~> string // This will require ./node_modules/B.js.flow -var B2 = require(\'B.js\'); +var B2 = require('B.js'); (B2.fun(): string); // Error number ~> string -var C = require(\'package_with_full_main\'); +var C = require('package_with_full_main'); (C.fun(): string); // Error number ~> string -var D = require(\'package_with_partial_main\'); +var D = require('package_with_partial_main'); (D.fun(): string); // Error number ~> string -var E = require(\'package_with_no_package_json\'); +var E = require('package_with_no_package_json'); (E.fun(): string); // Error number ~> string -var F = require(\'package_with_dir_main\'); +var F = require('package_with_dir_main'); (F.fun(): string); // Error number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -49,17 +49,17 @@ var F = require(\'package_with_dir_main\'); // Error number ~> string // Error number ~> string // Error number ~> string -var B1 = require(\"B\"); +var B1 = require("B"); (B1.fun(): string); -var B2 = require(\"B.js\"); +var B2 = require("B.js"); (B2.fun(): string); -var C = require(\"package_with_full_main\"); +var C = require("package_with_full_main"); (C.fun(): string); -var D = require(\"package_with_partial_main\"); +var D = require("package_with_partial_main"); (D.fun(): string); -var E = require(\"package_with_no_package_json\"); +var E = require("package_with_no_package_json"); (E.fun(): string); -var F = require(\"package_with_dir_main\"); +var F = require("package_with_dir_main"); (F.fun(): string); " `; @@ -68,14 +68,14 @@ exports[`test test_relative.js 1`] = ` "/* @flow */ // This will require ./A.js.flow -var A1 = require(\'./A\'); +var A1 = require('./A'); (A1.fun(): string); // Error number ~> string // This will require ./A.js.flow -var A2 = require(\'./A.js\'); +var A2 = require('./A.js'); (A2.fun(): string); // Error number ~> string -var CJS = require(\'./CJS.js\'); +var CJS = require('./CJS.js'); (CJS: string); (CJS: number); // Error: string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -85,11 +85,11 @@ var CJS = require(\'./CJS.js\'); // This will require ./A.js.flow // Error number ~> string // Error: string ~> number -var A1 = require(\"./A\"); +var A1 = require("./A"); (A1.fun(): string); -var A2 = require(\"./A.js\"); +var A2 = require("./A.js"); (A2.fun(): string); -var CJS = require(\"./CJS.js\"); +var CJS = require("./CJS.js"); (CJS: string); (CJS: number); " diff --git a/tests/declare_class/__snapshots__/jsfmt.spec.js.snap b/tests/declare_class/__snapshots__/jsfmt.spec.js.snap index 457205ea3..25f33b6c7 100644 --- a/tests/declare_class/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_class/__snapshots__/jsfmt.spec.js.snap @@ -4,16 +4,16 @@ exports[`test declare_class.js 1`] = ` static foo(x: number): void; } -C.x = ""; -C.foo(""); +C.x = \"\"; +C.foo(\"\"); (C.name: string); -(C.name: number); // error, it's a string +(C.name: number); // error, it\'s a string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error, it's a string -declare class C { x: number, foo: : (x: number) => void } -C.x = ""; -C.foo(""); +// error, it\'s a string +declare class C { static x: number; static foo(x: number): void } +C.x = \"\"; +C.foo(\"\"); (C.name: string); (C.name: number); " diff --git a/tests/declare_class/lib/__snapshots__/jsfmt.spec.js.snap b/tests/declare_class/lib/__snapshots__/jsfmt.spec.js.snap index b1b631e31..912318f39 100644 --- a/tests/declare_class/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_class/lib/__snapshots__/jsfmt.spec.js.snap @@ -9,8 +9,8 @@ declare class D extends _module.C { foo(): string; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare class _C { foo: : () => number } +declare class _C { foo(): number } declare var _module: { C: Class<_C> }; -declare class D { foo: : () => string } +declare class D extends _module.C { foo(): string } " `; diff --git a/tests/declare_export/__snapshots__/jsfmt.spec.js.snap b/tests/declare_export/__snapshots__/jsfmt.spec.js.snap index 5752dbef1..18450d66c 100644 --- a/tests/declare_export/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_export/__snapshots__/jsfmt.spec.js.snap @@ -132,7 +132,7 @@ declare export default () => number; * @providesModule ES6_Default_AnonFunction1 * @flow */ -declare export default : () => number +declare export default () => number " `; @@ -148,7 +148,7 @@ declare export default () =>number; * @providesModule ES6_Default_AnonFunction2 * @flow */ -declare export default : () => number +declare export default () => number " `; @@ -173,7 +173,7 @@ declare export function getAFoo(): FooImpl; // Regression test for https://github.com/facebook/flow/issues/511 // // Default-exported class should also be available in local scope -declare export default class FooImpl { givesANum: : () => number } +declare export default class FooImpl { givesANum(): number } declare export { FooImpl as Foo } declare export function getAFoo(): FooImpl; " @@ -191,7 +191,7 @@ declare export default class Foo { givesANum(): number; }; * @providesModule ES6_Default_NamedClass2 * @flow */ -declare export default class Foo { givesANum: : () => number } +declare export default class Foo { givesANum(): number } " `; @@ -245,13 +245,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = ` * @flow */ -declare export * from \"ES6_ExportAllFrom_Source1\"; +declare export * from "ES6_ExportAllFrom_Source1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary1 * @flow */ -declare export * from \"ES6_ExportAllFrom_Source1\" +declare export * from "ES6_ExportAllFrom_Source1" " `; @@ -261,13 +261,13 @@ exports[`test ES6_ExportAllFrom_Intermediary2.js 1`] = ` * @flow */ -declare export * from \"ES6_ExportAllFrom_Source2\"; +declare export * from "ES6_ExportAllFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary2 * @flow */ -declare export * from \"ES6_ExportAllFrom_Source2\" +declare export * from "ES6_ExportAllFrom_Source2" " `; @@ -306,12 +306,12 @@ declare export var numberValue2: number; exports[`test ES6_ExportAllFromMulti.js 1`] = ` "// @flow -declare export * from \"./ES6_ExportAllFrom_Source1\"; -declare export * from \"./ES6_ExportAllFrom_Source2\"; +declare export * from "./ES6_ExportAllFrom_Source1"; +declare export * from "./ES6_ExportAllFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -declare export * from \"./ES6_ExportAllFrom_Source1\" -declare export * from \"./ES6_ExportAllFrom_Source2\" +declare export * from "./ES6_ExportAllFrom_Source1" +declare export * from "./ES6_ExportAllFrom_Source2" " `; @@ -324,13 +324,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = ` declare export { numberValue1, numberValue2 as numberValue2_renamed -} from \"ES6_ExportFrom_Source1\"; +} from "ES6_ExportFrom_Source1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary1 * @flow */ -declare export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\" +declare export { numberValue1, numberValue2 as numberValue2_renamed } from "ES6_ExportFrom_Source1" " `; @@ -343,13 +343,13 @@ exports[`test ES6_ExportFrom_Intermediary2.js 1`] = ` declare export { numberValue1, numberValue2 as numberValue2_renamed2 -} from \"ES6_ExportFrom_Source2\"; +} from "ES6_ExportFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary2 * @flow */ -declare export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\" +declare export { numberValue1, numberValue2 as numberValue2_renamed2 } from "ES6_ExportFrom_Source2" " `; @@ -426,7 +426,7 @@ declare export { specifierNumber2 as specifierNumber2Renamed } declare export { specifierNumber3 } declare export { groupedSpecifierNumber1, groupedSpecifierNumber2 } declare export function givesANumber(): number; -declare export class NumberGenerator { givesANumber: : () => number } +declare export class NumberGenerator { givesANumber(): number } declare export var varDeclNumber1: number; declare export var varDeclNumber2: number; " @@ -465,7 +465,7 @@ declare export { specifierNumber4 } declare export { specifierNumber5 as specifierNumber5Renamed } declare export { groupedSpecifierNumber3, groupedSpecifierNumber4 } declare export function givesANumber2(): number; -declare export class NumberGenerator2 { givesANumber: : () => number } +declare export class NumberGenerator2 { givesANumber(): number } declare export var varDeclNumber3: number; declare export var varDeclNumber4: number; " @@ -481,7 +481,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \"str\"; +exports.stringValue = "str"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A @@ -491,7 +491,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \"str\"; +exports.stringValue = "str"; " `; @@ -568,44 +568,44 @@ exports[`test es6modules.js 1`] = ` // ===================== // // @providesModule -import * as DefaultA from \"A\"; +import * as DefaultA from "A"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; // Error: number ~> string // File path -import * as DefaultB from \"./B\"; +import * as DefaultB from "./B"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; // Error: number ~> string // C.js exists, but not as a providesModule -import DefaultC from \"C\"; // Error: No such module +import DefaultC from "C"; // Error: No such module // @providesModule D exists, but not as a filename -import DefaultD from \"./D\"; // Error: No such module +import DefaultD from "./D"; // Error: No such module // ================================================ // // == CommonJS Clobbering Literal Exports -> ES6 == // // ================================================ // -import {doesntExist1} from \"CommonJS_Clobbering_Lit\"; // Error: Not an exported binding +import {doesntExist1} from "CommonJS_Clobbering_Lit"; // Error: Not an exported binding -import {numberValue1} from \"CommonJS_Clobbering_Lit\"; +import {numberValue1} from "CommonJS_Clobbering_Lit"; var c1: number = numberValue1; var c2: string = numberValue1; // Error: number ~> string -import {numberValue2 as numVal1} from \"CommonJS_Clobbering_Lit\"; +import {numberValue2 as numVal1} from "CommonJS_Clobbering_Lit"; var d1: number = numVal1; var d2: string = numVal1; // Error: number ~> string -import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; +import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string -CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn\'t a property +CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn't a property -import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; +import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; -CJS_Clobb_Lit_NS.default.default; // Error: No \'default\' property on the exported obj +CJS_Clobb_Lit_NS.default.default; // Error: No 'default' property on the exported obj var f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> string @@ -613,15 +613,15 @@ var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> stri // == CommonJS Clobbering Class Exports -> ES6 == // // ============================================== // -import {doesntExist2} from \"CommonJS_Clobbering_Class\"; // Error: Not an exported binding +import {doesntExist2} from "CommonJS_Clobbering_Class"; // Error: Not an exported binding // The following import should error because class statics are not turned into // named exports for now. This avoids complexities with polymorphic static // members (where the polymophism is defined on the class itself rather than the // method). -import {staticNumber1, baseProp, childProp} from \"CommonJS_Clobbering_Class\"; // Error +import {staticNumber1, baseProp, childProp} from "CommonJS_Clobbering_Class"; // Error -import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; +import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property var h1: number = CJS_Clobb_Class.staticNumber2(); @@ -629,8 +629,8 @@ var h2: string = CJS_Clobb_Class.staticNumber2(); // Error: number ~> string var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string -import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; -new CJS_Clobb_Class_NS(); // Error: Namespace object isn\'t constructable +import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; +new CJS_Clobb_Class_NS(); // Error: Namespace object isn't constructable var i1: number = CJS_Clobb_Class_NS.staticNumber3(); // Error: Class statics not copied to Namespace object var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string @@ -639,22 +639,22 @@ var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: numbe // == CommonJS Named Exports -> ES6 == // // =================================== // -import {doesntExist3} from \"CommonJS_Named\"; // Error: Not an exported binding +import {doesntExist3} from "CommonJS_Named"; // Error: Not an exported binding -import {numberValue2} from \"CommonJS_Named\"; +import {numberValue2} from "CommonJS_Named"; var j1: number = numberValue2; var j2: string = numberValue2; // Error: number ~> string -import {numberValue3 as numVal3} from \"CommonJS_Named\"; +import {numberValue3 as numVal3} from "CommonJS_Named"; var k1: number = numVal3; var k2: string = numVal3; // Error: number ~> string -import * as CJS_Named from \"CommonJS_Named\"; +import * as CJS_Named from "CommonJS_Named"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; // Error: number ~> string -CJS_Named.doesntExist; // Error: doesntExist isn\'t a property +CJS_Named.doesntExist; // Error: doesntExist isn't a property -import * as CJS_Named_NS from \"CommonJS_Named\"; +import * as CJS_Named_NS from "CommonJS_Named"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string @@ -663,13 +663,13 @@ var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string // == ES6 Default -> ES6 == // ////////////////////////////// -import {doesntExist4} from \"ES6_Default_AnonFunction1\"; // Error: Not an exported binding +import {doesntExist4} from "ES6_Default_AnonFunction1"; // Error: Not an exported binding -import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; +import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string -import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; +import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string @@ -677,7 +677,7 @@ var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string -import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; +import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string @@ -685,35 +685,35 @@ var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> stri // == ES6 Named -> ES6 == // //////////////////////////// -import doesntExist5 from \"ES6_Named1\"; // Error: Not an exported binding +import doesntExist5 from "ES6_Named1"; // Error: Not an exported binding -import {specifierNumber1 as specifierNumber1_1} from \"ES6_Named1\"; +import {specifierNumber1 as specifierNumber1_1} from "ES6_Named1"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; // Error: number ~> string -import {specifierNumber2Renamed} from \"ES6_Named1\"; +import {specifierNumber2Renamed} from "ES6_Named1"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; // Error: number ~> string -import {specifierNumber3 as specifierNumber3Renamed} from \"ES6_Named1\"; +import {specifierNumber3 as specifierNumber3Renamed} from "ES6_Named1"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; // Error: number ~> string -import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\"; +import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; // Error: number ~> string var u4: string = groupedSpecifierNumber2; // Error: number ~> string -import {givesANumber} from \"ES6_Named1\"; +import {givesANumber} from "ES6_Named1"; var v1: number = givesANumber(); var v2: string = givesANumber(); // Error: number ~> string -import {NumberGenerator} from \"ES6_Named1\"; +import {NumberGenerator} from "ES6_Named1"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string -import {varDeclNumber1, varDeclNumber2} from \"ES6_Named1\"; +import {varDeclNumber1, varDeclNumber2} from "ES6_Named1"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; // Error: number ~> string @@ -727,15 +727,15 @@ var x4: string = varDeclNumber2; // Error: number ~> string -import {numberValue1 as numberValue4} from \"ES6_ExportFrom_Intermediary1\"; +import {numberValue1 as numberValue4} from "ES6_ExportFrom_Intermediary1"; var aa1: number = numberValue4; var aa2: string = numberValue4; // Error: number ~> string -import {numberValue2_renamed} from \"ES6_ExportFrom_Intermediary1\"; +import {numberValue2_renamed} from "ES6_ExportFrom_Intermediary1"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; // Error: number ~> string -import {numberValue1 as numberValue5} from \"ES6_ExportAllFrom_Intermediary1\"; +import {numberValue1 as numberValue5} from "ES6_ExportAllFrom_Intermediary1"; var ac1: number = numberValue5; var ac2: string = numberValue5; // Error: number ~> string @@ -743,13 +743,13 @@ var ac2: string = numberValue5; // Error: number ~> string // == ES6 Default -> CommonJS == // /////////////////////////////////// -require(\'ES6_Default_AnonFunction2\').doesntExist; // Error: \'doesntExist\' isn\'t an export +require('ES6_Default_AnonFunction2').doesntExist; // Error: 'doesntExist' isn't an export -var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; +var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string -var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; +var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string @@ -757,7 +757,7 @@ var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string -var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; +var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string @@ -765,31 +765,31 @@ var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> str // == ES6 Named -> CommonJS == // ///////////////////////////////// -var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; +var specifierNumber4 = require("ES6_Named2").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; // Error: number ~> string -var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; +var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; // Error: number ~> string -var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; // Error: number ~> string var aj4: string = groupedSpecifierNumber4; // Error: number ~> string -var givesANumber2 = require(\"ES6_Named2\").givesANumber2; +var givesANumber2 = require("ES6_Named2").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); // Error: number ~> string -var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; +var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string -var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; -var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; +var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; +var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; // Error: number ~> string @@ -803,15 +803,15 @@ var am4: string = varDeclNumber4; // Error: number ~> string -var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; +var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; // Error: number ~> string -var numberValue2_renamed2 = require(\"ES6_ExportFrom_Intermediary2\").numberValue2_renamed2; +var numberValue2_renamed2 = require("ES6_ExportFrom_Intermediary2").numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; // Error: number ~> string -var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; +var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; // Error: number ~> string @@ -819,7 +819,7 @@ var ar2: string = numberValue7; // Error: number ~> string // == ES6 Default+Named -> ES6 import Default+Named== // //////////////////////////////////////////////////////// -import defaultNum, {str as namedStr} from \"./ES6_DefaultAndNamed\"; +import defaultNum, {str as namedStr} from "./ES6_DefaultAndNamed"; var as1: number = defaultNum; var as2: string = defaultNum; // Error: number ~> string @@ -831,13 +831,13 @@ var as4: number = namedStr; // Error: string ~> number // == Side-effect only ES6 imports == // //////////////////////////////////////// -import \"./SideEffects\"; +import "./SideEffects"; ////////////////////////////////////////////// // == Suggest export name on likely typo == // ////////////////////////////////////////////// -import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`? -import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`? +import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`? +import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`? /////////////////////////////////////////////////// // == Multi \`export *\` should combine exports == // @@ -845,7 +845,7 @@ import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifier import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from \"./ES6_ExportAllFromMulti\"; +} from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string @@ -872,8 +872,8 @@ var at4: string = numberValue9; // Error: number ~> string // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn\'t a property -// Error: No \'default\' property on the exported obj +// Error: doesntExist isn't a property +// Error: No 'default' property on the exported obj // Error: number ~> string // Error: number ~> string // ============================================== // @@ -888,7 +888,7 @@ var at4: string = numberValue9; // Error: number ~> string // Error: Class has no \`doesntExist\` property // Error: number ~> string // Error: number ~> string -// Error: Namespace object isn\'t constructable +// Error: Namespace object isn't constructable // Error: Class statics not copied to Namespace object // Error: number ~> string // =================================== // @@ -898,7 +898,7 @@ var at4: string = numberValue9; // Error: number ~> string // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn\'t a property +// Error: doesntExist isn't a property // Error: CommonJS_Named has no default export // Error: number ~> string ////////////////////////////// @@ -927,7 +927,7 @@ var at4: string = numberValue9; // Error: number ~> string /////////////////////////////////// // == ES6 Default -> CommonJS == // /////////////////////////////////// -// Error: \'doesntExist\' isn\'t an export +// Error: 'doesntExist' isn't an export // Error: number ~> string // Error: number ~> string // Error: number ~> string @@ -963,159 +963,159 @@ var at4: string = numberValue9; // Error: number ~> string /////////////////////////////////////////////////// // Error: number ~> string // Error: number ~> string -import * as DefaultA from \"A\"; +import * as DefaultA from "A"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; -import * as DefaultB from \"./B\"; +import * as DefaultB from "./B"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; -import DefaultC from \"C\"; -import DefaultD from \"./D\"; -import { doesntExist1 } from \"CommonJS_Clobbering_Lit\"; -import { numberValue1 } from \"CommonJS_Clobbering_Lit\"; +import DefaultC from "C"; +import DefaultD from "./D"; +import { doesntExist1 } from "CommonJS_Clobbering_Lit"; +import { numberValue1 } from "CommonJS_Clobbering_Lit"; var c1: number = numberValue1; var c2: string = numberValue1; -import { numberValue2 as numVal1 } from \"CommonJS_Clobbering_Lit\"; +import { numberValue2 as numVal1 } from "CommonJS_Clobbering_Lit"; var d1: number = numVal1; var d2: string = numVal1; -import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; +import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; CJS_Clobb_Lit.doesntExist; -import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; +import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; CJS_Clobb_Lit_NS.default.default; var f3: string = CJS_Clobb_Lit_NS.numberValue4; var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; -import { doesntExist2 } from \"CommonJS_Clobbering_Class\"; -import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\"; -import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; +import { doesntExist2 } from "CommonJS_Clobbering_Class"; +import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class"; +import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; var h1: number = CJS_Clobb_Class.staticNumber2(); var h2: string = CJS_Clobb_Class.staticNumber2(); var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); -import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; +import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; new CJS_Clobb_Class_NS(); var i1: number = CJS_Clobb_Class_NS.staticNumber3(); var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); -import { doesntExist3 } from \"CommonJS_Named\"; -import { numberValue2 } from \"CommonJS_Named\"; +import { doesntExist3 } from "CommonJS_Named"; +import { numberValue2 } from "CommonJS_Named"; var j1: number = numberValue2; var j2: string = numberValue2; -import { numberValue3 as numVal3 } from \"CommonJS_Named\"; +import { numberValue3 as numVal3 } from "CommonJS_Named"; var k1: number = numVal3; var k2: string = numVal3; -import * as CJS_Named from \"CommonJS_Named\"; +import * as CJS_Named from "CommonJS_Named"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; CJS_Named.doesntExist; -import * as CJS_Named_NS from \"CommonJS_Named\"; +import * as CJS_Named_NS from "CommonJS_Named"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; var m3: string = CJS_Named_NS.numberValue4; -import { doesntExist4 } from \"ES6_Default_AnonFunction1\"; -import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; +import { doesntExist4 } from "ES6_Default_AnonFunction1"; +import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); -import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; +import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); -import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; +import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); -import doesntExist5 from \"ES6_Named1\"; -import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\"; +import doesntExist5 from "ES6_Named1"; +import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; -import { specifierNumber2Renamed } from \"ES6_Named1\"; +import { specifierNumber2Renamed } from "ES6_Named1"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; -import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\"; +import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; -import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\"; +import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; var u4: string = groupedSpecifierNumber2; -import { givesANumber } from \"ES6_Named1\"; +import { givesANumber } from "ES6_Named1"; var v1: number = givesANumber(); var v2: string = givesANumber(); -import { NumberGenerator } from \"ES6_Named1\"; +import { NumberGenerator } from "ES6_Named1"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); -import { varDeclNumber1, varDeclNumber2 } from \"ES6_Named1\"; +import { varDeclNumber1, varDeclNumber2 } from "ES6_Named1"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; var x4: string = varDeclNumber2; -import { numberValue1 as numberValue4 } from \"ES6_ExportFrom_Intermediary1\"; +import { numberValue1 as numberValue4 } from "ES6_ExportFrom_Intermediary1"; var aa1: number = numberValue4; var aa2: string = numberValue4; -import { numberValue2_renamed } from \"ES6_ExportFrom_Intermediary1\"; +import { numberValue2_renamed } from "ES6_ExportFrom_Intermediary1"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; -import { numberValue1 as numberValue5 } from \"ES6_ExportAllFrom_Intermediary1\"; +import { numberValue1 as numberValue5 } from "ES6_ExportAllFrom_Intermediary1"; var ac1: number = numberValue5; var ac2: string = numberValue5; -require(\"ES6_Default_AnonFunction2\").doesntExist; -var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; +require("ES6_Default_AnonFunction2").doesntExist; +var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); -var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; +var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); -var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; +var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); -var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; +var specifierNumber4 = require("ES6_Named2").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; -var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; +var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; -var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; var aj4: string = groupedSpecifierNumber4; -var givesANumber2 = require(\"ES6_Named2\").givesANumber2; +var givesANumber2 = require("ES6_Named2").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); -var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; +var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); -var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; -var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; +var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; +var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; var am4: string = varDeclNumber4; -var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; +var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; var numberValue2_renamed2 = require( - \"ES6_ExportFrom_Intermediary2\" + "ES6_ExportFrom_Intermediary2" ).numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; -var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; +var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; -import defaultNum, { str as namedStr } from \"./ES6_DefaultAndNamed\"; +import defaultNum, { str as namedStr } from "./ES6_DefaultAndNamed"; var as1: number = defaultNum; var as2: string = defaultNum; var as3: string = namedStr; var as4: number = namedStr; -import \"./SideEffects\"; -import specifierNumber1 from \"ES6_Named1\"; -import { specifierNumber } from \"ES6_Named1\"; -import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\"; +import "./SideEffects"; +import specifierNumber1 from "ES6_Named1"; +import { specifierNumber } from "ES6_Named1"; +import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; var at3: number = numberValue9; diff --git a/tests/declare_fun/__snapshots__/jsfmt.spec.js.snap b/tests/declare_fun/__snapshots__/jsfmt.spec.js.snap index 6a2659ccc..b43e39d7c 100644 --- a/tests/declare_fun/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_fun/__snapshots__/jsfmt.spec.js.snap @@ -12,7 +12,7 @@ declare function foo(x: X): X; // error, boolean ~/~ undefined declare function foo(x: number): string; declare function foo(x: string): number; -declare function foo(x: X): X; +declare function foo(x: X): X; (foo(0): string); (foo(\"hello\"): number); (foo(false): void); diff --git a/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap b/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap index 8bb999e61..df2034722 100644 --- a/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_module_exports/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test main.js 1`] = ` "// @flow -import declare_module_exports from \"declare_module_exports\"; +import declare_module_exports from "declare_module_exports"; (declare_module_exports: number); (declare_module_exports: string); // Error: number ~> string -// Error: Has no named export \"str\"! -import {str} from \"declare_m_e_with_other_value_declares\"; +// Error: Has no named export "str"! +import {str} from "declare_m_e_with_other_value_declares"; -import type {str2} from \"declare_m_e_with_other_type_declares\"; -(\"asdf\": str2); +import type {str2} from "declare_m_e_with_other_type_declares"; +("asdf": str2); (42: str2); // Error: number ~> string /** @@ -17,17 +17,17 @@ import type {str2} from \"declare_m_e_with_other_type_declares\"; * syntaxes will work. */ -import DEPRECATED__declare_var_exports from \"DEPRECATED__declare_var_exports\"; +import DEPRECATED__declare_var_exports from "DEPRECATED__declare_var_exports"; (DEPRECATED__declare_var_exports: number); (DEPRECATED__declare_var_exports: string); // Error: number ~> string -import declare_m_e_with_declare_var_e from \"declare_m_e_with_declare_var_e\"; +import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e"; (declare_m_e_with_declare_var_e: number); (declare_m_e_with_declare_var_e: string); // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: number ~> string -// Error: Has no named export \"str\"! +// Error: Has no named export "str"! // Error: number ~> string /** * \`declare var exports\` is deprecated, so we have a grace period where both @@ -35,17 +35,17 @@ import declare_m_e_with_declare_var_e from \"declare_m_e_with_declare_var_e\"; */ // Error: number ~> string // Error: number ~> string -import declare_module_exports from \"declare_module_exports\"; +import declare_module_exports from "declare_module_exports"; (declare_module_exports: number); (declare_module_exports: string); -import { str } from \"declare_m_e_with_other_value_declares\"; -import type { str2 } from \"declare_m_e_with_other_type_declares\"; -(\"asdf\": str2); +import { str } from "declare_m_e_with_other_value_declares"; +import type { str2 } from "declare_m_e_with_other_type_declares"; +("asdf": str2); (42: str2); -import DEPRECATED__declare_var_exports from \"DEPRECATED__declare_var_exports\"; +import DEPRECATED__declare_var_exports from "DEPRECATED__declare_var_exports"; (DEPRECATED__declare_var_exports: number); (DEPRECATED__declare_var_exports: string); -import declare_m_e_with_declare_var_e from \"declare_m_e_with_declare_var_e\"; +import declare_m_e_with_declare_var_e from "declare_m_e_with_declare_var_e"; (declare_m_e_with_declare_var_e: number); (declare_m_e_with_declare_var_e: string); " diff --git a/tests/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap index 99f69fa54..2ef52a3f0 100644 --- a/tests/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_module_exports/flow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test libs.js 1`] = ` -"declare module "declare_module_exports" { +"declare module \"declare_module_exports\" { declare module.exports: number; } -declare module "declare_m_e_with_other_value_declares" { +declare module \"declare_m_e_with_other_value_declares\" { declare module.exports: number; declare var str: string; } -declare module "declare_m_e_with_other_type_declares" { +declare module \"declare_m_e_with_other_type_declares\" { declare module.exports: number; declare type str2 = string; } @@ -18,14 +18,14 @@ declare module "declare_m_e_with_other_type_declares" { * syntaxes will work. */ -declare module "DEPRECATED__declare_var_exports" { +declare module \"DEPRECATED__declare_var_exports\" { declare var exports: number; } /** * Ensure that, if both are present, \`declare module.exports\` wins */ -declare module "declare_m_e_with_declare_var_e" { +declare module \"declare_m_e_with_declare_var_e\" { declare module.exports: number; declare var exports: string; } @@ -37,22 +37,22 @@ declare module "declare_m_e_with_declare_var_e" { /** * Ensure that, if both are present, \`declare module.exports\` wins */ -declare module "declare_module_exports" { - declare module.exports: number +declare module \"declare_module_exports\" { + declare module.exports: number; } -declare module "declare_m_e_with_other_value_declares" { - declare module.exports: number +declare module \"declare_m_e_with_other_value_declares\" { + declare module.exports: number; declare var str: string; } -declare module "declare_m_e_with_other_type_declares" { - declare module.exports: number - type str2 = string; +declare module \"declare_m_e_with_other_type_declares\" { + declare module.exports: number; + declare type str2 = string; } -declare module "DEPRECATED__declare_var_exports" { +declare module \"DEPRECATED__declare_var_exports\" { declare var exports: number; } -declare module "declare_m_e_with_declare_var_e" { - declare module.exports: number +declare module \"declare_m_e_with_declare_var_e\" { + declare module.exports: number; declare var exports: string; } " diff --git a/tests/declare_type/__snapshots__/jsfmt.spec.js.snap b/tests/declare_type/__snapshots__/jsfmt.spec.js.snap index 299932eee..ec1f29a99 100644 --- a/tests/declare_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_type/__snapshots__/jsfmt.spec.js.snap @@ -6,21 +6,21 @@ exports[`test import_declare_type.js 1`] = ` //////////////////////////////////////////////////////////// // == Import Declared Type Alias From Declared Module == // ////////////////////////////////////////////////////////// -import type {baz} from \"ModuleAliasFoo\"; -import {foo} from \"ModuleAliasFoo\"; +import type {baz} from "ModuleAliasFoo"; +import {foo} from "ModuleAliasFoo"; var k1: baz = 42; -var k2: baz = \"shab\"; // Error: string to int +var k2: baz = "shab"; // Error: string to int var k3: toz = foo(k1); // works -import type {toz} from \"ModuleAliasFoo\"; +import type {toz} from "ModuleAliasFoo"; var k4: toz = foo(k1); // works ////////////////////////////////////////////////////////// // == Declared Module with exports prop (issue 880) == // //////////////////////////////////////////////////////// -import blah from \'foo\'; -import type { Foo, Bar, Id } from \'foo\'; +import blah from 'foo'; +import type { Foo, Bar, Id } from 'foo'; blah(0, 0); @@ -28,7 +28,7 @@ blah(0, 0); (3 : Bar); // error : number ~> A -(\"lol\" : Id); // error : string ~> number +("lol" : Id); // error : string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -45,18 +45,18 @@ blah(0, 0); // error : {toz : number} ~> string // error : number ~> A // error : string ~> number -import type { baz } from \"ModuleAliasFoo\"; -import { foo } from \"ModuleAliasFoo\"; +import type { baz } from "ModuleAliasFoo"; +import { foo } from "ModuleAliasFoo"; var k1: baz = 42; -var k2: baz = \"shab\"; +var k2: baz = "shab"; var k3: toz = foo(k1); -import type { toz } from \"ModuleAliasFoo\"; +import type { toz } from "ModuleAliasFoo"; var k4: toz = foo(k1); -import blah from \"foo\"; -import type { Foo, Bar, Id } from \"foo\"; +import blah from "foo"; +import type { Foo, Bar, Id } from "foo"; blah(0, 0); ({ toz: 3 }: Foo); (3: Bar); -(\"lol\": Id); +("lol": Id); " `; diff --git a/tests/declare_type/lib/__snapshots__/jsfmt.spec.js.snap b/tests/declare_type/lib/__snapshots__/jsfmt.spec.js.snap index e20738166..17504770f 100644 --- a/tests/declare_type/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/declare_type/lib/__snapshots__/jsfmt.spec.js.snap @@ -13,8 +13,8 @@ declare module ModuleAliasFoo { * @flow */ declare module ModuleAliasFoo { - type baz = number; - type toz = string; + declare type baz = number; + declare type toz = string; declare function foo(bar: baz): toz; } " @@ -23,7 +23,7 @@ declare module ModuleAliasFoo { exports[`test declare_type_exports.js 1`] = ` "/* @flow */ -declare module 'foo' { +declare module \'foo\' { declare class A { toz : number } @@ -40,12 +40,12 @@ declare module 'foo' { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -declare module "foo" { +declare module \"foo\" { declare class A { toz: number } declare var n: string; - type Foo = typeof n; - type Bar = A; - type Id = T; + declare type Foo = typeof n; + declare type Bar = A; + declare type Id = T; declare var exports: { (a: number, b: number): number }; } " diff --git a/tests/demo/2/__snapshots__/jsfmt.spec.js.snap b/tests/demo/2/__snapshots__/jsfmt.spec.js.snap index d62a8fbbb..ac8f8bcb0 100644 --- a/tests/demo/2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/demo/2/__snapshots__/jsfmt.spec.js.snap @@ -43,11 +43,11 @@ module.exports = A; `; exports[`test B.js 1`] = ` -"var A = require(\'Demo\'); +"var A = require('Demo'); -var z = new A(\"42\").getX(); +var z = new A("42").getX(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var A = require(\"Demo\"); -var z = new A(\"42\").getX(); +var A = require("Demo"); +var z = new A("42").getX(); " `; diff --git a/tests/destructuring/__snapshots__/jsfmt.spec.js.snap b/tests/destructuring/__snapshots__/jsfmt.spec.js.snap index 741407459..6419c5eb0 100644 --- a/tests/destructuring/__snapshots__/jsfmt.spec.js.snap +++ b/tests/destructuring/__snapshots__/jsfmt.spec.js.snap @@ -342,11 +342,11 @@ function foo({ p, z: [ r ] }) { foo({ p: 0, z: [ 1, 2 ] }); [ a, , b, ...c ] = [ 0, 1, true, 3 ]; function bar({ x, ...z }) { - var o: { x: string, y: number } = z; + var o: { x: string; y: number } = z; } bar({ x: \"\", y: 0 }); var spread = { y: \"\" }; -var extend: { x: number, y: string, z: boolean } = { x: 0, ...spread }; +var extend: { x: number; y: string; z: boolean } = { x: 0, ...spread }; function qux(_: { a: number }) { } @@ -387,21 +387,6 @@ var cp2_err: string = others.childprop2; " `; -exports[`test destructuring_init.js 1`] = ` -"var {foo}; -var [bar]; -var []; -var {}; -var [], {toz}; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var { foo }; -var [ bar ]; -var [ ]; -var {}; -var [ ]{ toz }; -" -`; - exports[`test destructuring_param.js 1`] = ` "function f(a, { b }) { return a + b; @@ -491,18 +476,18 @@ type Prop = { prop: X }; function obj_pattern2({ prop }) { } -function arr_pattern([ elem ]) { +function arr_pattern([ elem ]: X[]) { } type Elem = X[]; -function arr_pattern2([ elem ]) { +function arr_pattern2([ elem ]: Elem) { } -function tup_pattern([ proj ]) { +function tup_pattern([ proj ]: [X]) { } type Proj = [X]; -function tup_pattern2([ proj ]) { +function tup_pattern2([ proj ]: Proj) { } function rest_antipattern(...t: T) { @@ -514,15 +499,15 @@ function rest_pattern(...r: X[]) { function obj_rest_pattern({ _, ...o }) { o.x; } -type ObjRest = { _: any, x: X }; +type ObjRest = { _: any; x: X }; function obj_rest_pattern({ _, ...o }) { o.x; } -function arr_rest_pattern([ _, ...a ]) { +function arr_rest_pattern([ _, ...a ]: [any, X]) { a[0]; } -type ArrRest = [anyX]; -function arr_rest_pattern([ _, ...a ]) { +type ArrRest = [any, X]; +function arr_rest_pattern([ _, ...a ]: ArrRest) { a[0]; } " diff --git a/tests/destructuring/destructuring_init.js b/tests/destructuring/destructuring_init.js deleted file mode 100644 index 2a62fe434..000000000 --- a/tests/destructuring/destructuring_init.js +++ /dev/null @@ -1,5 +0,0 @@ -var {foo}; -var [bar]; -var []; -var {}; -var [], {toz}; diff --git a/tests/dictionary/__snapshots__/jsfmt.spec.js.snap b/tests/dictionary/__snapshots__/jsfmt.spec.js.snap index 103c8ee71..55b42a917 100644 --- a/tests/dictionary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/dictionary/__snapshots__/jsfmt.spec.js.snap @@ -41,8 +41,8 @@ function foo0(x: Array<{ [key: string]: mixed }>): Array<{ return x; } function foo2(x: { [key: string]: number }): { - [key: string]: number, - +toString: : () => string + [key: string]: number; + +toString: () => string } { return x; } @@ -526,21 +526,21 @@ function add_prop_to_nonstring_key_dot(o: { [k: number]: any }) { function add_prop_to_nonstring_key_bracket(o: { [k: number]: any }) { o[0] = \"ok\"; } -function mix_with_declared_props(o: { [k: number]: X, p: Y }, x: X, y: Y) { +function mix_with_declared_props(o: { [k: number]: X; p: Y }, x: X, y: Y) { (o[0]: X); (o.p: Y); o[0] = x; o.p = y; } function object_prototype(o: { [k: string]: number }): { - [k: string]: number, - +toString: : () => string + [k: string]: number; + +toString: () => string } { (o.toString(): boolean); return o; } function unsound_string_conversion_alias_declared_prop( - o: { [k: number]: any, \"0\": X } + o: { [k: number]: any; \"0\": X } ) { o[0] = \"not-x\"; } @@ -576,16 +576,16 @@ function subtype_dict_keys_invariant(x: { [k: B]: any }) { function unification_mix_with_declared_props_invariant_l( x: Array<{ [k: string]: B }> ) { - let a: Array<{ [k: string]: B, p: A }> = x; + let a: Array<{ [k: string]: B; p: A }> = x; a[0].p = new A(); - let b: Array<{ [k: string]: B, p: B }> = x; - let c: Array<{ [k: string]: B, p: C }> = x; + let b: Array<{ [k: string]: B; p: B }> = x; + let c: Array<{ [k: string]: B; p: C }> = x; (x[0].p: C); } function unification_mix_with_declared_props_invariant_r( - xa: Array<{ [k: string]: A, p: B }>, - xb: Array<{ [k: string]: B, p: B }>, - xc: Array<{ [k: string]: C, p: B }> + xa: Array<{ [k: string]: A; p: B }>, + xb: Array<{ [k: string]: B; p: B }>, + xc: Array<{ [k: string]: C; p: B }> ) { let a: Array<{ [k: string]: A }> = xa; a[0].p = new A(); @@ -594,16 +594,16 @@ function unification_mix_with_declared_props_invariant_r( (xc[0].p: C); } function subtype_mix_with_declared_props_invariant_l(x: { [k: string]: B }) { - let a: { [k: string]: B, p: A } = x; + let a: { [k: string]: B; p: A } = x; a.p = new A(); - let b: { [k: string]: B, p: B } = x; - let c: { [k: string]: B, p: C } = x; + let b: { [k: string]: B; p: B } = x; + let c: { [k: string]: B; p: C } = x; (x.p: C); } function subtype_mix_with_declared_props_invariant_r( - xa: { [k: string]: A, p: B }, - xb: { [k: string]: B, p: B }, - xc: { [k: string]: C, p: B } + xa: { [k: string]: A; p: B }, + xb: { [k: string]: B; p: B }, + xc: { [k: string]: C; p: B } ) { let a: { [k: string]: A } = xa; a.p = new A(); @@ -635,20 +635,20 @@ function subtype_obj_to_dict(x: { p: B }) { let c: { [k: string]: C } = x; (x.p: C); } -function subtype_obj_to_mixed(x: { p: B, x: X }) { - let a: { [k: string]: A, x: X } = x; - let b: { [k: string]: B, x: X } = x; - let c: { [k: string]: C, x: X } = x; +function subtype_obj_to_mixed(x: { p: B; x: X }) { + let a: { [k: string]: A; x: X } = x; + let b: { [k: string]: B; x: X } = x; + let c: { [k: string]: C; x: X } = x; } function unification_dict_to_mixed(x: Array<{ [k: string]: B }>) { - let a: Array<{ [k: string]: B, p: A }> = x; - let b: Array<{ [k: string]: B, p: B }> = x; - let c: Array<{ [k: string]: B, p: C }> = x; + let a: Array<{ [k: string]: B; p: A }> = x; + let b: Array<{ [k: string]: B; p: B }> = x; + let c: Array<{ [k: string]: B; p: C }> = x; } function subtype_dict_to_mixed(x: { [k: string]: B }) { - let a: { [k: string]: B, p: A } = x; - let b: { [k: string]: B, p: B } = x; - let c: { [k: string]: B, p: C } = x; + let a: { [k: string]: B; p: A } = x; + let b: { [k: string]: B; p: B } = x; + let c: { [k: string]: B; p: C } = x; } function subtype_dict_to_optional_a(x: { [k: string]: B }) { let a: { p?: A } = x; @@ -756,13 +756,13 @@ function foo0(x: Array<{ [key: string]: number }>): Array<{ return x; } function foo1(x: Array<{ [key: string]: number }>): Array<{ - [key: string]: number, + [key: string]: number; fooBar: string }> { return x; } function foo2(x: Array<{ [key: string]: mixed }>): Array<{ - [key: string]: mixed, + [key: string]: mixed; fooBar: string }> { x[0].fooBar = 123; @@ -772,7 +772,7 @@ function foo3(x: { [key: string]: number }): { foo: number } { return x; } function foo4(x: { [key: string]: number }): { - [key: string]: number, + [key: string]: number; foo: string } { return x; @@ -783,7 +783,7 @@ function foo5(x: Array<{ [key: string]: number }>): Array<{ foo: number }> { function foo6(x: Array<{ foo: number }>): Array<{ [key: string]: number }> { return x; } -function foo7(x: { [key: string]: number, bar: string }) { +function foo7(x: { [key: string]: number; bar: string }) { (x.bar: string); } function foo8(x: { [key: string]: number }) { @@ -859,8 +859,8 @@ var o: { foo: QueryFunction } = { module.exports = o; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error, number ~/~ string -type Params = { [name: string]: string, count: number }; -type QueryFunction = : (params: Params) => string; +type Params = { [name: string]: string; count: number }; +type QueryFunction = (params: Params) => string; var o: { foo: QueryFunction } = { foo(params) { return params.count; diff --git a/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap b/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap index 3938f66f4..84a5806fa 100644 --- a/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap +++ b/tests/disjoint-union-perf/__snapshots__/jsfmt.spec.js.snap @@ -85,54 +85,54 @@ export type TypedNode = */ export type InferredType = \"unknown\" | \"gender\" | \"enum\" | \"number-or-string\" | \"number\" | \"string\" | \"error\"; export type Pos = { - firstLine: number, - firstColumn: number, - lastLine: number, + firstLine: number; + firstColumn: number; + lastLine: number; lastColumn: number }; export type TypedBinaryOpNode = { - exprNodeType: \"binary_op\", - binaryOp: \"plus\" | \"multiply\" | \"divide\" | \"minus\", - lhs: TypedNode, - rhs: TypedNode, - pos: Pos, - exprType: InferredType, + exprNodeType: \"binary_op\"; + binaryOp: \"plus\" | \"multiply\" | \"divide\" | \"minus\"; + lhs: TypedNode; + rhs: TypedNode; + pos: Pos; + exprType: InferredType; typed: true }; export type TypedUnaryMinusNode = { - exprNodeType: \"unary_minus\", - op: TypedNode, - pos: Pos, - exprType: InferredType, + exprNodeType: \"unary_minus\"; + op: TypedNode; + pos: Pos; + exprType: InferredType; typed: true }; export type TypedNumberNode = { - exprNodeType: \"number\", - value: number, - pos: Pos, - exprType: \"number\", + exprNodeType: \"number\"; + value: number; + pos: Pos; + exprType: \"number\"; typed: true }; export type TypedStringLiteralNode = { - exprNodeType: \"string_literal\", - value: string, - pos: Pos, - exprType: \"string\", + exprNodeType: \"string_literal\"; + value: string; + pos: Pos; + exprType: \"string\"; typed: true }; export type TypedVariableNode = { - exprNodeType: \"variable\", - name: string, - pos: Pos, - exprType: InferredType, + exprNodeType: \"variable\"; + name: string; + pos: Pos; + exprType: InferredType; typed: true }; export type TypedFunctionInvocationNode = { - exprNodeType: \"function_invocation\", - name: string, - parameters: TypedNode[], - pos: Pos, - exprType: \"error\" | \"string\", + exprNodeType: \"function_invocation\"; + name: string; + parameters: TypedNode[]; + pos: Pos; + exprType: \"error\" | \"string\"; typed: true }; export type TypedNode = TypedBinaryOpNode | TypedUnaryMinusNode | TypedNumberNode | TypedStringLiteralNode | TypedVariableNode | TypedFunctionInvocationNode; @@ -914,31 +914,31 @@ export const builders : { // ast-types exports all expressions as patterns. // That seems not like it was intended. export type Comment = { - loc: ?SourceLocation, - value: string, - leading: boolean, + loc: ?SourceLocation; + value: string; + leading: boolean; trailing: boolean }; export type SourceLocation = { - start: SourcePosition, - end: SourcePosition, + start: SourcePosition; + end: SourcePosition; source: ?string }; -export type SourcePosition = { line: number, column: number }; +export type SourcePosition = { line: number; column: number }; export type File = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"File\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"File\"; program: Program }; export type Program = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"Program\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"Program\"; body: Statement[] }; export type BinaryOperator = \"==\" | \"!=\" | \"===\" | \"!==\" | \"<\" | \"<=\" | \">\" | \">=\" | \"<<\" | \">>\" | \">>>\" | \"+\" | \"-\" | \"*\" | \"/\" | \"%\" | \"&\" | \"|\" | \"^\" | \"in\" | \"instanceof\" | \"..\"; @@ -949,337 +949,368 @@ export type LogicalOperator = \"&&\" | \"||\"; export type Node = EmptyStatement | BlockStatement | ExpressionStatement | IfStatement | BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | WhileStatement | ForStatement | ForInStatement | TryStatement | CatchClause | Identifier | Literal | ThisExpression | ArrayExpression | ObjectExpreession | Property | FunctionExpression | BinaryExpression | UnaryExpression | AssignmentExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | MemberExpression | VariableDeclaration | FunctionDeclaration | VariableDeclarator; export type Statement = BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement | WhileStatement | ForStatement | ForInStatement | TryStatement | Declaration; export type EmptyStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; type: \"EmptyStatement\" }; export type BlockStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"BlockStatement\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"BlockStatement\"; body: Statement[] }; export type ExpressionStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ExpressionStatement\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ExpressionStatement\"; expression: Expression }; export type IfStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"IfStatement\", - test: Expression, - consequent: Statement, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"IfStatement\"; + test: Expression; + consequent: Statement; alternate: ?Statement }; export type BreakStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"BreakStatement\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"BreakStatement\"; label: ?Identifier }; export type ContinueStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ContinueStatement\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ContinueStatement\"; label: ?Identifier }; export type ReturnStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ReturnStatement\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ReturnStatement\"; argument: ?Expression }; export type ThrowStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ThrowStatement\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ThrowStatement\"; argument: ?Expression }; export type WhileStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"WhileStatement\", - test: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"WhileStatement\"; + test: Expression; body: Statement }; export type ForStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ForStatement\", - init: ?(VariableDeclaration | Expression), - test: ?Expression, - update: ?Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ForStatement\"; + init: ?(VariableDeclaration | Expression); + test: ?Expression; + update: ?Expression; body: Statement }; export type ForInStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ForInStatement\", - left: VariableDeclaration | Expression, - right: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ForInStatement\"; + left: VariableDeclaration | Expression; + right: Expression; body: Statement }; export type TryStatement = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"TryStatement\", - block: BlockStatement, - handler: ?CatchClause, - handlers: CatchClause[], + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"TryStatement\"; + block: BlockStatement; + handler: ?CatchClause; + handlers: CatchClause[]; finalizer: ?BlockStatement }; export type CatchClause = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"CatchClause\", - param: Pattern, - guard: ?Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"CatchClause\"; + param: Pattern; + guard: ?Expression; body: BlockStatement }; export type Expression = Identifier | ThisExpression | Literal | FunctionExpression | BinaryExpression | UnaryExpression | AssignmentExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | MemberExpression | ArrayExpression | ObjectExpreession; export type Identifier = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"Identifier\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"Identifier\"; name: string }; export type Literal = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"Literal\", - value: ?(string | boolean | number | RegExp), - regex: ?{ pattern: string, flags: string } + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"Literal\"; + value: ?(string | boolean | number | RegExp); + regex: ?{ pattern: string; flags: string } }; export type ThisExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; type: \"ThisExpression\" }; export type ArrayExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ArrayExpression\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ArrayExpression\"; elements: Expression[] }; export type ObjectExpreession = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ObjectExpression\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ObjectExpression\"; properties: Property[] }; export type Property = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"Property\", - kind: \"init\" | \"get\" | \"set\", - key: Literal | Identifier, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"Property\"; + kind: \"init\" | \"get\" | \"set\"; + key: Literal | Identifier; value: Expression }; export type FunctionExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"FunctionExpression\", - id: ?Identifier, - params: Pattern[], + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"FunctionExpression\"; + id: ?Identifier; + params: Pattern[]; body: BlockStatement }; export type BinaryExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"BinaryExpression\", - operator: BinaryOperator, - left: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"BinaryExpression\"; + operator: BinaryOperator; + left: Expression; right: Expression }; export type UnaryExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"UnaryExpression\", - operator: UnaryOperator, - argument: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"UnaryExpression\"; + operator: UnaryOperator; + argument: Expression; prefix: boolean }; export type AssignmentExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"AssignmentExpression\", - operator: AssignmentOperator, - left: Pattern, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"AssignmentExpression\"; + operator: AssignmentOperator; + left: Pattern; right: Expression }; export type UpdateExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"UpdateExpression\", - operator: UpdateOperator, - argument: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"UpdateExpression\"; + operator: UpdateOperator; + argument: Expression; prefix: boolean }; export type LogicalExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"LogicalExpression\", - operator: LogicalOperator, - left: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"LogicalExpression\"; + operator: LogicalOperator; + left: Expression; right: Expression }; export type ConditionalExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"ConditionalExpression\", - test: Expression, - consequent: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"ConditionalExpression\"; + test: Expression; + consequent: Expression; alternate: Expression }; export type NewExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"NewExpression\", - callee: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"NewExpression\"; + callee: Expression; arguments: Expression[] }; export type CallExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"CallExpression\", - callee: Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"CallExpression\"; + callee: Expression; arguments: Expression[] }; export type MemberExpression = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"MemberExpression\", - object: Expression, - property: Identifier | Expression, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"MemberExpression\"; + object: Expression; + property: Identifier | Expression; computed: boolean }; export type Pattern = Identifier; export type Declaration = VariableDeclaration | FunctionDeclaration; export type VariableDeclaration = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"VariableDeclaration\", - kind: \"var\" | \"let\" | \"const\", + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"VariableDeclaration\"; + kind: \"var\" | \"let\" | \"const\"; declarations: VariableDeclarator[] }; export type FunctionDeclaration = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"FunctionDeclaration\", - id: Identifier, - body: BlockStatement, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"FunctionDeclaration\"; + id: Identifier; + body: BlockStatement; params: Pattern[] }; export type VariableDeclarator = { - source: ?string, - start: SourcePosition, - end: SourcePosition, - comments: ?Array, - type: \"VariableDeclarator\", - id: Pattern, + source: ?string; + start: SourcePosition; + end: SourcePosition; + comments: ?Array; + type: \"VariableDeclarator\"; + id: Pattern; init: ?Expression }; const a: any = null; export const builders: { - emptyStatement: : () => EmptyStatement, - blockStatement: : (body: Statement[]) => BlockStatement, - expressionStatement: : (expression: Expression) => ExpressionStatement, - ifStatement: : (test: Expression, consequent: Statement, alternate?: Statement) => IfStatement, - breakStatement: : (label?: Identifier) => BreakStatement, - continueStatement: : (label?: Identifier) => ContinueStatement, - returnStatement: : (argument: ?Expression) => ReturnStatement, - throwStatement: : (argument: ?Expression) => ThrowStatement, - whileStatement: : (test: Expression, body: Statement) => WhileStatement, - forStatement: : (init: ?(VariableDeclaration | Expression), test: ?Expression, update: ?Expression, body: Statement) => ForStatement, - forInStatement: : (left: VariableDeclaration | Expression, right: Expression, body: Statement) => ForInStatement, - tryStatement: : (block: BlockStatement, handler: ?CatchClause, handlers: CatchClause[], finalizer?: BlockStatement) => TryStatement, - catchClause: : (param: Pattern, guard: ?Expression, body: BlockStatement) => CatchClause, - identifier: : (name: string) => Identifier, - literal: : (value: ?(string | boolean | number | RegExp), regex?: { - pattern: string, - flags: string - }) => Literal, - thisExpression: : () => ThisExpression, - arrayExpression: : (elements: Expression[]) => ArrayExpression, - objectExpreession: : (properties: Property[]) => ObjectExpreession, - property: : (kind: \"init\" | \"get\" | \"set\", key: Literal | Identifier, value: Expression) => Property, - functionExpression: : (id: ?Identifier, params: Pattern[], body: BlockStatement) => FunctionExpression, - binaryExpression: : (operator: BinaryOperator, left: Expression, right: Expression) => BinaryExpression, - unaryExpression: : (operator: UnaryOperator, argument: Expression, prefix: boolean) => UnaryExpression, - assignmentExpression: : (operator: AssignmentOperator, left: Pattern, right: Expression) => AssignmentExpression, - updateExpression: : (operator: UpdateOperator, argument: Expression, prefix: boolean) => UpdateExpression, - logicalExpression: : (operator: LogicalOperator, left: Expression, right: Expression) => LogicalExpression, - conditionalExpression: : (test: Expression, consequent: Expression, alternate: Expression) => ConditionalExpression, - newExpression: : (callee: Expression, arguments: Expression[]) => NewExpression, - callExpression: : (callee: Expression, arguments: Expression[]) => CallExpression, - memberExpression: : (object: Expression, property: Identifier | Expression, computed: boolean) => MemberExpression, - variableDeclaration: : (kind: \"var\" | \"let\" | \"const\", declarations: VariableDeclarator[]) => VariableDeclaration, - functionDeclaration: : (id: Identifier, body: BlockStatement, params: Pattern[]) => FunctionDeclaration, - variableDeclarator: : (id: Pattern, init?: Expression) => VariableDeclarator + emptyStatement(): EmptyStatement; + blockStatement(body: Statement[]): BlockStatement; + expressionStatement(expression: Expression): ExpressionStatement; + ifStatement(test: Expression, + consequent: Statement, + alternate?: Statement): IfStatement; + breakStatement(label?: Identifier): BreakStatement; + continueStatement(label?: Identifier): ContinueStatement; + returnStatement(argument: ?Expression): ReturnStatement; + throwStatement(argument: ?Expression): ThrowStatement; + whileStatement(test: Expression, body: Statement): WhileStatement; + forStatement(init: ?(VariableDeclaration | Expression), + test: ?Expression, + update: ?Expression, + body: Statement): ForStatement; + forInStatement(left: VariableDeclaration | Expression, + right: Expression, + body: Statement): ForInStatement; + tryStatement(block: BlockStatement, + handler: ?CatchClause, + handlers: CatchClause[], + finalizer?: BlockStatement): TryStatement; + catchClause(param: Pattern, + guard: ?Expression, + body: BlockStatement): CatchClause; + identifier(name: string): Identifier; + literal(value: ?(string | boolean | number | RegExp), + regex?: { pattern: string; flags: string }): Literal; + thisExpression(): ThisExpression; + arrayExpression(elements: Expression[]): ArrayExpression; + objectExpreession(properties: Property[]): ObjectExpreession; + property(kind: \"init\" | \"get\" | \"set\", + key: Literal | Identifier, + value: Expression): Property; + functionExpression(id: ?Identifier, + params: Pattern[], + body: BlockStatement): FunctionExpression; + binaryExpression(operator: BinaryOperator, + left: Expression, + right: Expression): BinaryExpression; + unaryExpression(operator: UnaryOperator, + argument: Expression, + prefix: boolean): UnaryExpression; + assignmentExpression(operator: AssignmentOperator, + left: Pattern, + right: Expression): AssignmentExpression; + updateExpression(operator: UpdateOperator, + argument: Expression, + prefix: boolean): UpdateExpression; + logicalExpression(operator: LogicalOperator, + left: Expression, + right: Expression): LogicalExpression; + conditionalExpression(test: Expression, + consequent: Expression, + alternate: Expression): ConditionalExpression; + newExpression(callee: Expression, arguments: Expression[]): NewExpression; + callExpression(callee: Expression, arguments: Expression[]): CallExpression; + memberExpression(object: Expression, + property: Identifier | Expression, + computed: boolean): MemberExpression; + variableDeclaration(kind: \"var\" | \"let\" | \"const\", + declarations: VariableDeclarator[]): VariableDeclaration; + functionDeclaration(id: Identifier, + body: BlockStatement, + params: Pattern[]): FunctionDeclaration; + variableDeclarator(id: Pattern, init?: Expression): VariableDeclarator } = a; " `; diff --git a/tests/dom/__snapshots__/jsfmt.spec.js.snap b/tests/dom/__snapshots__/jsfmt.spec.js.snap index f62e8cbb6..3fd4f9e8e 100644 --- a/tests/dom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/dom/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ let tests = [ // moveTo function(ctx: CanvasRenderingContext2D) { - ctx.moveTo(\'0\', \'1\'); // error: should be numbers + ctx.moveTo('0', '1'); // error: should be numbers }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -22,7 +22,7 @@ let tests = [ ctx.fillRect(0, 0, 200, 100); }, function(ctx: CanvasRenderingContext2D) { - ctx.moveTo(\"0\", \"1\"); + ctx.moveTo("0", "1"); } ]; " @@ -34,8 +34,8 @@ exports[`test CustomEvent.js 1`] = ` let tests = [ // CustomEvent function(document: Document) { - const event = document.createEvent(\'CustomEvent\'); - event.initCustomEvent(\'butts\', true, false, { nice: 42 }); + const event = document.createEvent('CustomEvent'); + event.initCustomEvent('butts', true, false, { nice: 42 }); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -43,8 +43,8 @@ let tests = [ // CustomEvent let tests = [ function(document: Document) { - const event = document.createEvent(\"CustomEvent\"); - event.initCustomEvent(\"butts\", true, false, { nice: 42 }); + const event = document.createEvent("CustomEvent"); + event.initCustomEvent("butts", true, false, { nice: 42 }); } ]; " @@ -56,10 +56,10 @@ exports[`test Document.js 1`] = ` let tests = [ // createElement function(document: Document) { - (document.createElement(\'canvas\'): HTMLCanvasElement); - (document.createElement(\'link\'): HTMLLinkElement); - (document.createElement(\'option\'): HTMLOptionElement); - (document.createElement(\'select\'): HTMLSelectElement); + (document.createElement('canvas'): HTMLCanvasElement); + (document.createElement('link'): HTMLLinkElement); + (document.createElement('option'): HTMLOptionElement); + (document.createElement('select'): HTMLSelectElement); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -67,10 +67,10 @@ let tests = [ // createElement let tests = [ function(document: Document) { - (document.createElement(\"canvas\"): HTMLCanvasElement); - (document.createElement(\"link\"): HTMLLinkElement); - (document.createElement(\"option\"): HTMLOptionElement); - (document.createElement(\"select\"): HTMLSelectElement); + (document.createElement("canvas"): HTMLCanvasElement); + (document.createElement("link"): HTMLLinkElement); + (document.createElement("option"): HTMLOptionElement); + (document.createElement("select"): HTMLSelectElement); } ]; " @@ -85,13 +85,13 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: \'smooth\', block: \'end\' }); - element.scrollIntoView({ block: \'end\' }); - element.scrollIntoView({ behavior: \'smooth\' }); + element.scrollIntoView({ behavior: 'smooth', block: 'end' }); + element.scrollIntoView({ block: 'end' }); + element.scrollIntoView({ behavior: 'smooth' }); // fails - element.scrollIntoView({ behavior: \'invalid\' }); - element.scrollIntoView({ block: \'invalid\' }); + element.scrollIntoView({ behavior: 'invalid' }); + element.scrollIntoView({ block: 'invalid' }); element.scrollIntoView(1); } ]; @@ -104,11 +104,11 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: \"smooth\", block: \"end\" }); - element.scrollIntoView({ block: \"end\" }); - element.scrollIntoView({ behavior: \"smooth\" }); - element.scrollIntoView({ behavior: \"invalid\" }); - element.scrollIntoView({ block: \"invalid\" }); + element.scrollIntoView({ behavior: "smooth", block: "end" }); + element.scrollIntoView({ block: "end" }); + element.scrollIntoView({ behavior: "smooth" }); + element.scrollIntoView({ behavior: "invalid" }); + element.scrollIntoView({ block: "invalid" }); element.scrollIntoView(1); } ]; @@ -121,7 +121,7 @@ exports[`test HTMLCanvasElement.js 1`] = ` let tests = [ // getContext function(el: HTMLCanvasElement) { - (el.getContext(\'2d\'): ?CanvasRenderingContext2D); + (el.getContext('2d'): ?CanvasRenderingContext2D); } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -129,7 +129,7 @@ let tests = [ // getContext let tests = [ function(el: HTMLCanvasElement) { - (el.getContext(\"2d\"): ?CanvasRenderingContext2D); + (el.getContext("2d"): ?CanvasRenderingContext2D); } ]; " @@ -144,13 +144,13 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: \'smooth\', block: \'end\' }); - element.scrollIntoView({ block: \'end\' }); - element.scrollIntoView({ behavior: \'smooth\' }); + element.scrollIntoView({ behavior: 'smooth', block: 'end' }); + element.scrollIntoView({ block: 'end' }); + element.scrollIntoView({ behavior: 'smooth' }); // fails - element.scrollIntoView({ behavior: \'invalid\' }); - element.scrollIntoView({ block: \'invalid\' }); + element.scrollIntoView({ behavior: 'invalid' }); + element.scrollIntoView({ block: 'invalid' }); element.scrollIntoView(1); } ]; @@ -163,11 +163,11 @@ let tests = [ element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({}); - element.scrollIntoView({ behavior: \"smooth\", block: \"end\" }); - element.scrollIntoView({ block: \"end\" }); - element.scrollIntoView({ behavior: \"smooth\" }); - element.scrollIntoView({ behavior: \"invalid\" }); - element.scrollIntoView({ block: \"invalid\" }); + element.scrollIntoView({ behavior: "smooth", block: "end" }); + element.scrollIntoView({ block: "end" }); + element.scrollIntoView({ behavior: "smooth" }); + element.scrollIntoView({ behavior: "invalid" }); + element.scrollIntoView({ block: "invalid" }); element.scrollIntoView(1); } ]; @@ -180,11 +180,11 @@ exports[`test HTMLInputElement.js 1`] = ` let tests = [ // setRangeText function(el: HTMLInputElement) { - el.setRangeText(\'foo\'); - el.setRangeText(\'foo\', 123); // end is required - el.setRangeText(\'foo\', 123, 234); - el.setRangeText(\'foo\', 123, 234, \'select\'); - el.setRangeText(\'foo\', 123, 234, \'bogus\'); // invalid value + el.setRangeText('foo'); + el.setRangeText('foo', 123); // end is required + el.setRangeText('foo', 123, 234); + el.setRangeText('foo', 123, 234, 'select'); + el.setRangeText('foo', 123, 234, 'bogus'); // invalid value } ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -194,11 +194,11 @@ let tests = [ // invalid value let tests = [ function(el: HTMLInputElement) { - el.setRangeText(\"foo\"); - el.setRangeText(\"foo\", 123); - el.setRangeText(\"foo\", 123, 234); - el.setRangeText(\"foo\", 123, 234, \"select\"); - el.setRangeText(\"foo\", 123, 234, \"bogus\"); + el.setRangeText("foo"); + el.setRangeText("foo", 123); + el.setRangeText("foo", 123, 234); + el.setRangeText("foo", 123, 234, "select"); + el.setRangeText("foo", 123, 234, "bogus"); } ]; " @@ -207,9 +207,9 @@ let tests = [ exports[`test URL.js 1`] = ` "/* @flow */ -const a = new URL(\'http://flowtype.org/\'); // correct -const b = new URL(\'/docs\', a); // correct -const c = new URL(\'/docs\', \'http://flowtype.org/\'); // correct +const a = new URL('http://flowtype.org/'); // correct +const b = new URL('/docs', a); // correct +const c = new URL('/docs', 'http://flowtype.org/'); // correct const d: URLSearchParams = c.searchParams; // correct const e: string = c.path; // not correct @@ -244,9 +244,9 @@ const r: string = c.username; // correct // correct // correct // correct -const a = new URL(\"http://flowtype.org/\"); -const b = new URL(\"/docs\", a); -const c = new URL(\"/docs\", \"http://flowtype.org/\"); +const a = new URL("http://flowtype.org/"); +const b = new URL("/docs", a); +const c = new URL("/docs", "http://flowtype.org/"); const d: URLSearchParams = c.searchParams; const e: string = c.path; const f: string = c.pathname; @@ -273,15 +273,15 @@ let tests = [ // attachEvent function() { let target = new EventTarget(); - (target.attachEvent(\'foo\', listener): void); // invalid, may be undefined - (target.attachEvent && target.attachEvent(\'foo\', listener): void); // valid + (target.attachEvent('foo', listener): void); // invalid, may be undefined + (target.attachEvent && target.attachEvent('foo', listener): void); // valid }, // detachEvent function() { let target = new EventTarget(); - (target.detachEvent(\'foo\', listener): void); // invalid, may be undefined - (target.detachEvent && target.detachEvent(\'foo\', listener): void); // valid + (target.detachEvent('foo', listener): void); // invalid, may be undefined + (target.detachEvent && target.detachEvent('foo', listener): void); // valid }, function() { @@ -304,13 +304,13 @@ let listener: EventListener = function(event: Event): void { let tests = [ function() { let target = new EventTarget(); - (target.attachEvent(\"foo\", listener): void); - (target.attachEvent && target.attachEvent(\"foo\", listener): void); + (target.attachEvent("foo", listener): void); + (target.attachEvent && target.attachEvent("foo", listener): void); }, function() { let target = new EventTarget(); - (target.detachEvent(\"foo\", listener): void); - (target.detachEvent && target.detachEvent(\"foo\", listener): void); + (target.detachEvent("foo", listener): void); + (target.detachEvent && target.detachEvent("foo", listener): void); }, function() { window.onmessage = (event: MessageEvent) => { @@ -330,7 +330,7 @@ let tests = [ let path = new Path2D(); (path.arcTo(0, 0, 0, 0, 10): void); // valid (path.arcTo(0, 0, 0, 0, 10, 20, 5): void); // valid - (path.arcTo(0, 0, 0, 0, 10, \'20\', 5): void); // invalid + (path.arcTo(0, 0, 0, 0, 10, '20', 5): void); // invalid }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -344,7 +344,7 @@ let tests = [ let path = new Path2D(); (path.arcTo(0, 0, 0, 0, 10): void); (path.arcTo(0, 0, 0, 0, 10, 20, 5): void); - (path.arcTo(0, 0, 0, 0, 10, \"20\", 5): void); + (path.arcTo(0, 0, 0, 0, 10, "20", 5): void); } ]; " @@ -356,7 +356,7 @@ exports[`test registerElement.js 1`] = ` let tests = [ // should work with Object.create() function() { - document.registerElement(\'custom-element\', { + document.registerElement('custom-element', { prototype: Object.create(HTMLElement.prototype, { createdCallback: { value: function createdCallback () { }}, @@ -378,7 +378,7 @@ let tests = [ }, // or with Object.assign() function() { - document.registerElement(\'custom-element\', { + document.registerElement('custom-element', { prototype: Object.assign(Object.create(HTMLElement.prototype), { createdCallback () { }, @@ -398,7 +398,7 @@ let tests = [ }, // should complain about invalid callback parameters function() { - document.registerElement(\'custom-element\', { + document.registerElement('custom-element', { prototype: { attributeChangedCallback( localName: string, @@ -419,7 +419,7 @@ let tests = [ let tests = [ function() { document.registerElement( - \"custom-element\", + "custom-element", { prototype: Object.create( HTMLElement.prototype, @@ -456,7 +456,7 @@ let tests = [ }, function() { document.registerElement( - \"custom-element\", + "custom-element", { prototype: Object.assign( Object.create(HTMLElement.prototype), @@ -483,7 +483,7 @@ let tests = [ }, function() { document.registerElement( - \"custom-element\", + "custom-element", { prototype: { attributeChangedCallback(localName: string, @@ -683,16 +683,16 @@ let tests = [ // NodeFilterInterface function() { document.createNodeIterator(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid - document.createNodeIterator(document.body, -1, node => \'accept\'); // invalid + document.createNodeIterator(document.body, -1, node => 'accept'); // invalid document.createNodeIterator(document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT }); // valid - document.createNodeIterator(document.body, -1, { accept: node => \'accept\' }); // invalid + document.createNodeIterator(document.body, -1, { accept: node => 'accept' }); // invalid document.createNodeIterator(document.body, -1, {}); // invalid }, function() { document.createTreeWalker(document.body, -1, node => NodeFilter.FILTER_ACCEPT); // valid - document.createTreeWalker(document.body, -1, node => \'accept\'); // invalid + document.createTreeWalker(document.body, -1, node => 'accept'); // invalid document.createTreeWalker(document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT }); // valid - document.createTreeWalker(document.body, -1, { accept: node => \'accept\' }); // invalid + document.createTreeWalker(document.body, -1, { accept: node => 'accept' }); // invalid document.createTreeWalker(document.body, -1, {}); // invalid }, ]; @@ -897,7 +897,7 @@ let tests = [ -1, node => NodeFilter.FILTER_ACCEPT ); - document.createNodeIterator(document.body, -1, node => \"accept\"); + document.createNodeIterator(document.body, -1, node => "accept"); document.createNodeIterator( document.body, -1, @@ -906,7 +906,7 @@ let tests = [ document.createNodeIterator( document.body, -1, - { accept: node => \"accept\" } + { accept: node => "accept" } ); document.createNodeIterator(document.body, -1, {}); }, @@ -916,13 +916,13 @@ let tests = [ -1, node => NodeFilter.FILTER_ACCEPT ); - document.createTreeWalker(document.body, -1, node => \"accept\"); + document.createTreeWalker(document.body, -1, node => "accept"); document.createTreeWalker( document.body, -1, { accept: node => NodeFilter.FILTER_ACCEPT } ); - document.createTreeWalker(document.body, -1, { accept: node => \"accept\" }); + document.createTreeWalker(document.body, -1, { accept: node => "accept" }); document.createTreeWalker(document.body, -1, {}); } ]; diff --git a/tests/dump-types/__snapshots__/jsfmt.spec.js.snap b/tests/dump-types/__snapshots__/jsfmt.spec.js.snap index 089688f96..38fd1a026 100644 --- a/tests/dump-types/__snapshots__/jsfmt.spec.js.snap +++ b/tests/dump-types/__snapshots__/jsfmt.spec.js.snap @@ -17,7 +17,7 @@ module.exports = num; exports[`test test.js 1`] = ` "// @flow -var num = require(\'./import\'); +var num = require('./import'); function foo(x) { } foo(0); var a:string = num; @@ -40,7 +40,7 @@ const idxResult = idx(obj, obj => obj.a.b.c.d); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // test deduping of inferred types -var num = require(\"./import\"); +var num = require("./import"); function foo(x) { } diff --git a/tests/encaps/__snapshots__/jsfmt.spec.js.snap b/tests/encaps/__snapshots__/jsfmt.spec.js.snap index 425186a37..c25e009d9 100644 --- a/tests/encaps/__snapshots__/jsfmt.spec.js.snap +++ b/tests/encaps/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ function tag(strings,...values) { var s2 = tag \`l\${42}r\`; function tag2(strings,...values) { - return { foo: \"\" }; // ok: tagged templates can return whatever + return { foo: "" }; // ok: tagged templates can return whatever } var s3 = tag2 \`la la la\`; @@ -29,7 +29,7 @@ function tag(strings, ...values) { } var s2 = tag\`l\${42}r\`; function tag2(strings, ...values) { - return { foo: \"\" }; + return { foo: "" }; } var s3 = tag2\`la la la\`; (s3.foo: number); diff --git a/tests/enumerror/__snapshots__/jsfmt.spec.js.snap b/tests/enumerror/__snapshots__/jsfmt.spec.js.snap index db78064fd..6b348d0e4 100644 --- a/tests/enumerror/__snapshots__/jsfmt.spec.js.snap +++ b/tests/enumerror/__snapshots__/jsfmt.spec.js.snap @@ -30,7 +30,7 @@ function union2keys(s: Union): Keys { return s; } // ok // ok // ok function isActive( - ad: { state: $Keys<{ PAUSED: string, ACTIVE: string, DELETED: string }> } + ad: { state: $Keys<{ PAUSED: string; ACTIVE: string; DELETED: string }> } ): boolean { return ad.state === "ACTIVE"; } @@ -40,7 +40,7 @@ function isActive2(ad: { state: $Keys }): boolean { return ad.state === MyStates.ACTIVE; } isActive2({ state: "PAUSE" }); -type Keys = $Keys<{ x: any, y: any }>; +type Keys = $Keys<{ x: any; y: any }>; type Union = "x" | "y"; function keys2union(s: Keys): Union { return s; diff --git a/tests/equals/__snapshots__/jsfmt.spec.js.snap b/tests/equals/__snapshots__/jsfmt.spec.js.snap index 8830a42a8..756fac154 100644 --- a/tests/equals/__snapshots__/jsfmt.spec.js.snap +++ b/tests/equals/__snapshots__/jsfmt.spec.js.snap @@ -2,11 +2,11 @@ exports[`test equals.js 1`] = ` "/* @flow */ (1 == 1); -(\"foo\" == \"bar\"); +("foo" == "bar"); (1 == null); (null == 1); -(1 == \"\"); // error -(\"\" == 1); // error +(1 == ""); // error +("" == 1); // error var x = (null : ?number); (x == 1); @@ -16,11 +16,11 @@ var x = (null : ?number); // error // error 1 == 1; -\"foo\" == \"bar\"; +"foo" == "bar"; 1 == null; null == 1; -1 == \"\"; -\"\" == 1; +1 == ""; +"" == 1; var x = (null: ?number); x == 1; 1 == x; diff --git a/tests/es6modules/__snapshots__/jsfmt.spec.js.snap b/tests/es6modules/__snapshots__/jsfmt.spec.js.snap index ab8797558..cc7923aee 100644 --- a/tests/es6modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/es6modules/__snapshots__/jsfmt.spec.js.snap @@ -303,11 +303,11 @@ exports[`test ES6_DefaultAndNamed.js 1`] = ` "/* @flow */ export default 42; -export var str = \'asdf\'; +export var str = 'asdf'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ export default 42 -export var str = \"asdf\"; +export var str = "asdf"; " `; @@ -317,13 +317,13 @@ exports[`test ES6_ExportAllFrom_Intermediary1.js 1`] = ` * @flow */ -export * from \"ES6_ExportAllFrom_Source1\"; +export * from "ES6_ExportAllFrom_Source1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary1 * @flow */ -export * from \"ES6_ExportAllFrom_Source1\" +export * from "ES6_ExportAllFrom_Source1" " `; @@ -333,13 +333,13 @@ exports[`test ES6_ExportAllFrom_Intermediary2.js 1`] = ` * @flow */ -export * from \"ES6_ExportAllFrom_Source2\"; +export * from "ES6_ExportAllFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportAllFrom_Intermediary2 * @flow */ -export * from \"ES6_ExportAllFrom_Source2\" +export * from "ES6_ExportAllFrom_Source2" " `; @@ -378,12 +378,12 @@ export var numberValue2 = 1; exports[`test ES6_ExportAllFromMulti.js 1`] = ` "// @flow -export * from \"./ES6_ExportAllFrom_Source1\"; -export * from \"./ES6_ExportAllFrom_Source2\"; +export * from "./ES6_ExportAllFrom_Source1"; +export * from "./ES6_ExportAllFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export * from \"./ES6_ExportAllFrom_Source1\" -export * from \"./ES6_ExportAllFrom_Source2\" +export * from "./ES6_ExportAllFrom_Source1" +export * from "./ES6_ExportAllFrom_Source2" " `; @@ -396,13 +396,13 @@ exports[`test ES6_ExportFrom_Intermediary1.js 1`] = ` export { numberValue1, numberValue2 as numberValue2_renamed -} from \"ES6_ExportFrom_Source1\"; +} from "ES6_ExportFrom_Source1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary1 * @flow */ -export { numberValue1, numberValue2 as numberValue2_renamed } from \"ES6_ExportFrom_Source1\" +export { numberValue1, numberValue2 as numberValue2_renamed } from "ES6_ExportFrom_Source1" " `; @@ -415,13 +415,13 @@ exports[`test ES6_ExportFrom_Intermediary2.js 1`] = ` export { numberValue1, numberValue2 as numberValue2_renamed2 -} from \"ES6_ExportFrom_Source2\"; +} from "ES6_ExportFrom_Source2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule ES6_ExportFrom_Intermediary2 * @flow */ -export { numberValue1, numberValue2 as numberValue2_renamed2 } from \"ES6_ExportFrom_Source2\" +export { numberValue1, numberValue2 as numberValue2_renamed2 } from "ES6_ExportFrom_Source2" " `; @@ -575,7 +575,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \"str\"; +exports.stringValue = "str"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A @@ -585,7 +585,7 @@ exports.numberValue1 = 42; exports.numberValue2 = 42; exports.numberValue3 = 42; exports.numberValue4 = 42; -exports.stringValue = \"str\"; +exports.stringValue = "str"; " `; @@ -662,44 +662,44 @@ exports[`test es6modules.js 1`] = ` // ===================== // // @providesModule -import * as DefaultA from \"A\"; +import * as DefaultA from "A"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; // Error: number ~> string // File path -import * as DefaultB from \"./B\"; +import * as DefaultB from "./B"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; // Error: number ~> string // C.js exists, but not as a providesModule -import DefaultC from \"C\"; // Error: No such module +import DefaultC from "C"; // Error: No such module // @providesModule D exists, but not as a filename -import DefaultD from \"./D\"; // Error: No such module +import DefaultD from "./D"; // Error: No such module // ================================================ // // == CommonJS Clobbering Literal Exports -> ES6 == // // ================================================ // -import {doesntExist1} from \"CommonJS_Clobbering_Lit\"; // Error: Not an exported binding +import {doesntExist1} from "CommonJS_Clobbering_Lit"; // Error: Not an exported binding -import {numberValue1} from \"CommonJS_Clobbering_Lit\"; +import {numberValue1} from "CommonJS_Clobbering_Lit"; var c1: number = numberValue1; var c2: string = numberValue1; // Error: number ~> string -import {numberValue2 as numVal1} from \"CommonJS_Clobbering_Lit\"; +import {numberValue2 as numVal1} from "CommonJS_Clobbering_Lit"; var d1: number = numVal1; var d2: string = numVal1; // Error: number ~> string -import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; +import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; // Error: number ~> string -CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn\'t a property +CJS_Clobb_Lit.doesntExist; // Error: doesntExist isn't a property -import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; +import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; -CJS_Clobb_Lit_NS.default.default; // Error: No \'default\' property on the exported obj +CJS_Clobb_Lit_NS.default.default; // Error: No 'default' property on the exported obj var f3: string = CJS_Clobb_Lit_NS.numberValue4; // Error: number ~> string var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> string @@ -707,15 +707,15 @@ var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; // Error: number ~> stri // == CommonJS Clobbering Class Exports -> ES6 == // // ============================================== // -import {doesntExist2} from \"CommonJS_Clobbering_Class\"; // Error: Not an exported binding +import {doesntExist2} from "CommonJS_Clobbering_Class"; // Error: Not an exported binding // The following import should error because class statics are not turned into // named exports for now. This avoids complexities with polymorphic static // members (where the polymophism is defined on the class itself rather than the // method). -import {staticNumber1, baseProp, childProp} from \"CommonJS_Clobbering_Class\"; // Error +import {staticNumber1, baseProp, childProp} from "CommonJS_Clobbering_Class"; // Error -import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; +import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; // Error: Class has no \`doesntExist\` property var h1: number = CJS_Clobb_Class.staticNumber2(); @@ -723,8 +723,8 @@ var h2: string = CJS_Clobb_Class.staticNumber2(); // Error: number ~> string var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); // Error: number ~> string -import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; -new CJS_Clobb_Class_NS(); // Error: Namespace object isn\'t constructable +import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; +new CJS_Clobb_Class_NS(); // Error: Namespace object isn't constructable var i1: number = CJS_Clobb_Class_NS.staticNumber3(); // Error: Class statics not copied to Namespace object var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: number ~> string @@ -733,22 +733,22 @@ var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); // Error: numbe // == CommonJS Named Exports -> ES6 == // // =================================== // -import {doesntExist3} from \"CommonJS_Named\"; // Error: Not an exported binding +import {doesntExist3} from "CommonJS_Named"; // Error: Not an exported binding -import {numberValue2} from \"CommonJS_Named\"; +import {numberValue2} from "CommonJS_Named"; var j1: number = numberValue2; var j2: string = numberValue2; // Error: number ~> string -import {numberValue3 as numVal3} from \"CommonJS_Named\"; +import {numberValue3 as numVal3} from "CommonJS_Named"; var k1: number = numVal3; var k2: string = numVal3; // Error: number ~> string -import * as CJS_Named from \"CommonJS_Named\"; +import * as CJS_Named from "CommonJS_Named"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; // Error: number ~> string -CJS_Named.doesntExist; // Error: doesntExist isn\'t a property +CJS_Named.doesntExist; // Error: doesntExist isn't a property -import * as CJS_Named_NS from \"CommonJS_Named\"; +import * as CJS_Named_NS from "CommonJS_Named"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; // Error: CommonJS_Named has no default export var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string @@ -757,21 +757,21 @@ var m3: string = CJS_Named_NS.numberValue4; // Error: number ~> string // == ES6 Default -> ES6 == // ////////////////////////////// -import {doesntExist4} from \"ES6_Default_AnonFunction1\"; // Error: Not an exported binding +import {doesntExist4} from "ES6_Default_AnonFunction1"; // Error: Not an exported binding -import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; +import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); // Error: number ~> string -import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; +import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); // Error: number ~> string -import ES6_Def_AnonClass1 from \"ES6_Default_AnonClass1\"; +import ES6_Def_AnonClass1 from "ES6_Default_AnonClass1"; var p1: number = new ES6_Def_AnonClass1().givesANum(); var p2: string = new ES6_Def_AnonClass1().givesANum(); // Error: number ~> string -import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; +import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> string @@ -779,57 +779,57 @@ var q2: string = new ES6_Def_NamedClass1().givesANum(); // Error: number ~> stri // == ES6 Named -> ES6 == // //////////////////////////// -import doesntExist5 from \"ES6_Named1\"; // Error: Not an exported binding +import doesntExist5 from "ES6_Named1"; // Error: Not an exported binding -import {specifierNumber1 as specifierNumber1_1} from \"ES6_Named1\"; +import {specifierNumber1 as specifierNumber1_1} from "ES6_Named1"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; // Error: number ~> string -import {specifierNumber2Renamed} from \"ES6_Named1\"; +import {specifierNumber2Renamed} from "ES6_Named1"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; // Error: number ~> string -import {specifierNumber3 as specifierNumber3Renamed} from \"ES6_Named1\"; +import {specifierNumber3 as specifierNumber3Renamed} from "ES6_Named1"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; // Error: number ~> string -import {groupedSpecifierNumber1, groupedSpecifierNumber2} from \"ES6_Named1\"; +import {groupedSpecifierNumber1, groupedSpecifierNumber2} from "ES6_Named1"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; // Error: number ~> string var u4: string = groupedSpecifierNumber2; // Error: number ~> string -import {givesANumber} from \"ES6_Named1\"; +import {givesANumber} from "ES6_Named1"; var v1: number = givesANumber(); var v2: string = givesANumber(); // Error: number ~> string -import {NumberGenerator} from \"ES6_Named1\"; +import {NumberGenerator} from "ES6_Named1"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); // Error: number ~> string -import {varDeclNumber1, varDeclNumber2} from \"ES6_Named1\"; +import {varDeclNumber1, varDeclNumber2} from "ES6_Named1"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; // Error: number ~> string var x4: string = varDeclNumber2; // Error: number ~> string -import {destructuredObjNumber} from \"ES6_Named1\"; +import {destructuredObjNumber} from "ES6_Named1"; var y1: number = destructuredObjNumber; var y2: string = destructuredObjNumber; // Error: number ~> string -import {destructuredArrNumber} from \"ES6_Named1\"; +import {destructuredArrNumber} from "ES6_Named1"; var z1: number = destructuredArrNumber; var z2: string = destructuredArrNumber; // Error: number ~> string -import {numberValue1 as numberValue4} from \"ES6_ExportFrom_Intermediary1\"; +import {numberValue1 as numberValue4} from "ES6_ExportFrom_Intermediary1"; var aa1: number = numberValue4; var aa2: string = numberValue4; // Error: number ~> string -import {numberValue2_renamed} from \"ES6_ExportFrom_Intermediary1\"; +import {numberValue2_renamed} from "ES6_ExportFrom_Intermediary1"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; // Error: number ~> string -import {numberValue1 as numberValue5} from \"ES6_ExportAllFrom_Intermediary1\"; +import {numberValue1 as numberValue5} from "ES6_ExportAllFrom_Intermediary1"; var ac1: number = numberValue5; var ac2: string = numberValue5; // Error: number ~> string @@ -837,21 +837,21 @@ var ac2: string = numberValue5; // Error: number ~> string // == ES6 Default -> CommonJS == // /////////////////////////////////// -require(\'ES6_Default_AnonFunction2\').doesntExist; // Error: \'doesntExist\' isn\'t an export +require('ES6_Default_AnonFunction2').doesntExist; // Error: 'doesntExist' isn't an export -var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; +var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); // Error: number ~> string -var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; +var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); // Error: number ~> string -var ES6_Def_AnonClass2 = require(\"ES6_Default_AnonClass2\").default; +var ES6_Def_AnonClass2 = require("ES6_Default_AnonClass2").default; var af1: number = new ES6_Def_AnonClass2().givesANum(); var af2: string = new ES6_Def_AnonClass2().givesANum(); // Error: number ~> string -var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; +var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> string @@ -859,53 +859,53 @@ var ag2: string = new ES6_Def_NamedClass2().givesANum(); // Error: number ~> str // == ES6 Named -> CommonJS == // ///////////////////////////////// -var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; +var specifierNumber4 = require("ES6_Named2").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; // Error: number ~> string -var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; +var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; // Error: number ~> string -var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; // Error: number ~> string var aj4: string = groupedSpecifierNumber4; // Error: number ~> string -var givesANumber2 = require(\"ES6_Named2\").givesANumber2; +var givesANumber2 = require("ES6_Named2").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); // Error: number ~> string -var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; +var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); // Error: number ~> string -var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; -var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; +var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; +var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; // Error: number ~> string var am4: string = varDeclNumber4; // Error: number ~> string -var destructuredObjNumber2 = require(\"ES6_Named2\").destructuredObjNumber2; +var destructuredObjNumber2 = require("ES6_Named2").destructuredObjNumber2; var an1: number = destructuredObjNumber2; var an2: string = destructuredObjNumber2; // Error: number ~> string -var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2; +var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2; var ao1: number = destructuredArrNumber2; var ao2: string = destructuredArrNumber2; // Error: number ~> string -var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; +var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; // Error: number ~> string -var numberValue2_renamed2 = require(\"ES6_ExportFrom_Intermediary2\").numberValue2_renamed2; +var numberValue2_renamed2 = require("ES6_ExportFrom_Intermediary2").numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; // Error: number ~> string -var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; +var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; // Error: number ~> string @@ -913,7 +913,7 @@ var ar2: string = numberValue7; // Error: number ~> string // == ES6 Default+Named -> ES6 import Default+Named== // //////////////////////////////////////////////////////// -import defaultNum, {str as namedStr} from \"./ES6_DefaultAndNamed\"; +import defaultNum, {str as namedStr} from "./ES6_DefaultAndNamed"; var as1: number = defaultNum; var as2: string = defaultNum; // Error: number ~> string @@ -925,13 +925,13 @@ var as4: number = namedStr; // Error: string ~> number // == Side-effect only ES6 imports == // //////////////////////////////////////// -import \"./SideEffects\"; +import "./SideEffects"; ////////////////////////////////////////////// // == Suggest export name on likely typo == // ////////////////////////////////////////////// -import specifierNumber1 from \"ES6_Named1\"; // Error: Did you mean \`import {specifierNumber1} from ...\`? -import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifierNumber1\`? +import specifierNumber1 from "ES6_Named1"; // Error: Did you mean \`import {specifierNumber1} from ...\`? +import {specifierNumber} from "ES6_Named1"; // Error: Did you mean \`specifierNumber1\`? /////////////////////////////////////////////////// // == Multi \`export *\` should combine exports == // @@ -939,7 +939,7 @@ import {specifierNumber} from \"ES6_Named1\"; // Error: Did you mean \`specifier import { numberValue1 as numberValue8, numberValue2 as numberValue9 -} from \"./ES6_ExportAllFromMulti\"; +} from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; // Error: number ~> string @@ -950,7 +950,7 @@ var at4: string = numberValue9; // Error: number ~> string ///////////////////////////////////////////////////////////// // == Vanilla \`import\` cannot import a type-only export == // ///////////////////////////////////////////////////////////// -import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type alias! +import {typeAlias} from "./ExportType"; // Error: Cannot vanilla-import a type alias! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // ===================== // @@ -971,8 +971,8 @@ import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn\'t a property -// Error: No \'default\' property on the exported obj +// Error: doesntExist isn't a property +// Error: No 'default' property on the exported obj // Error: number ~> string // Error: number ~> string // ============================================== // @@ -987,7 +987,7 @@ import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type // Error: Class has no \`doesntExist\` property // Error: number ~> string // Error: number ~> string -// Error: Namespace object isn\'t constructable +// Error: Namespace object isn't constructable // Error: Class statics not copied to Namespace object // Error: number ~> string // =================================== // @@ -997,7 +997,7 @@ import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type // Error: number ~> string // Error: number ~> string // Error: number ~> string -// Error: doesntExist isn\'t a property +// Error: doesntExist isn't a property // Error: CommonJS_Named has no default export // Error: number ~> string ////////////////////////////// @@ -1029,7 +1029,7 @@ import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type /////////////////////////////////// // == ES6 Default -> CommonJS == // /////////////////////////////////// -// Error: \'doesntExist\' isn\'t an export +// Error: 'doesntExist' isn't an export // Error: number ~> string // Error: number ~> string // Error: number ~> string @@ -1072,182 +1072,182 @@ import {typeAlias} from \"./ExportType\"; // Error: Cannot vanilla-import a type // == Vanilla \`import\` cannot import a type-only export == // ///////////////////////////////////////////////////////////// // Error: Cannot vanilla-import a type alias! -import * as DefaultA from \"A\"; +import * as DefaultA from "A"; var a1: number = DefaultA.numberValue1; var a2: string = DefaultA.numberValue1; -import * as DefaultB from \"./B\"; +import * as DefaultB from "./B"; var b1: number = DefaultB.numberValue; var b2: string = DefaultB.numberValue; -import DefaultC from \"C\"; -import DefaultD from \"./D\"; -import { doesntExist1 } from \"CommonJS_Clobbering_Lit\"; -import { numberValue1 } from \"CommonJS_Clobbering_Lit\"; +import DefaultC from "C"; +import DefaultD from "./D"; +import { doesntExist1 } from "CommonJS_Clobbering_Lit"; +import { numberValue1 } from "CommonJS_Clobbering_Lit"; var c1: number = numberValue1; var c2: string = numberValue1; -import { numberValue2 as numVal1 } from \"CommonJS_Clobbering_Lit\"; +import { numberValue2 as numVal1 } from "CommonJS_Clobbering_Lit"; var d1: number = numVal1; var d2: string = numVal1; -import CJS_Clobb_Lit from \"CommonJS_Clobbering_Lit\"; +import CJS_Clobb_Lit from "CommonJS_Clobbering_Lit"; var e1: number = CJS_Clobb_Lit.numberValue3; var e2: string = CJS_Clobb_Lit.numberValue3; CJS_Clobb_Lit.doesntExist; -import * as CJS_Clobb_Lit_NS from \"CommonJS_Clobbering_Lit\"; +import * as CJS_Clobb_Lit_NS from "CommonJS_Clobbering_Lit"; var f1: number = CJS_Clobb_Lit_NS.numberValue4; var f2: number = CJS_Clobb_Lit_NS.default.numberValue4; CJS_Clobb_Lit_NS.default.default; var f3: string = CJS_Clobb_Lit_NS.numberValue4; var f4: string = CJS_Clobb_Lit_NS.default.numberValue5; -import { doesntExist2 } from \"CommonJS_Clobbering_Class\"; -import { staticNumber1, baseProp, childProp } from \"CommonJS_Clobbering_Class\"; -import CJS_Clobb_Class from \"CommonJS_Clobbering_Class\"; +import { doesntExist2 } from "CommonJS_Clobbering_Class"; +import { staticNumber1, baseProp, childProp } from "CommonJS_Clobbering_Class"; +import CJS_Clobb_Class from "CommonJS_Clobbering_Class"; new CJS_Clobb_Class(); new CJS_Clobb_Class().doesntExist; var h1: number = CJS_Clobb_Class.staticNumber2(); var h2: string = CJS_Clobb_Class.staticNumber2(); var h3: number = new CJS_Clobb_Class().instNumber1(); var h4: string = new CJS_Clobb_Class().instNumber1(); -import * as CJS_Clobb_Class_NS from \"CommonJS_Clobbering_Class\"; +import * as CJS_Clobb_Class_NS from "CommonJS_Clobbering_Class"; new CJS_Clobb_Class_NS(); var i1: number = CJS_Clobb_Class_NS.staticNumber3(); var i2: number = new CJS_Clobb_Class_NS.default().instNumber2(); var i3: string = new CJS_Clobb_Class_NS.default().instNumber2(); -import { doesntExist3 } from \"CommonJS_Named\"; -import { numberValue2 } from \"CommonJS_Named\"; +import { doesntExist3 } from "CommonJS_Named"; +import { numberValue2 } from "CommonJS_Named"; var j1: number = numberValue2; var j2: string = numberValue2; -import { numberValue3 as numVal3 } from \"CommonJS_Named\"; +import { numberValue3 as numVal3 } from "CommonJS_Named"; var k1: number = numVal3; var k2: string = numVal3; -import * as CJS_Named from \"CommonJS_Named\"; +import * as CJS_Named from "CommonJS_Named"; var l1: number = CJS_Named.numberValue1; var l2: string = CJS_Named.numberValue1; CJS_Named.doesntExist; -import * as CJS_Named_NS from \"CommonJS_Named\"; +import * as CJS_Named_NS from "CommonJS_Named"; var m1: number = CJS_Named_NS.numberValue4; var m2: string = CJS_Named_NS.default.numberValue4; var m3: string = CJS_Named_NS.numberValue4; -import { doesntExist4 } from \"ES6_Default_AnonFunction1\"; -import ES6_Def_AnonFunc1 from \"ES6_Default_AnonFunction1\"; +import { doesntExist4 } from "ES6_Default_AnonFunction1"; +import ES6_Def_AnonFunc1 from "ES6_Default_AnonFunction1"; var n1: number = ES6_Def_AnonFunc1(); var n2: string = ES6_Def_AnonFunc1(); -import ES6_Def_NamedFunc1 from \"ES6_Default_NamedFunction1\"; +import ES6_Def_NamedFunc1 from "ES6_Default_NamedFunction1"; var o1: number = ES6_Def_NamedFunc1(); var o2: string = ES6_Def_NamedFunc1(); -import ES6_Def_AnonClass1 from \"ES6_Default_AnonClass1\"; +import ES6_Def_AnonClass1 from "ES6_Default_AnonClass1"; var p1: number = new ES6_Def_AnonClass1().givesANum(); var p2: string = new ES6_Def_AnonClass1().givesANum(); -import ES6_Def_NamedClass1 from \"ES6_Default_NamedClass1\"; +import ES6_Def_NamedClass1 from "ES6_Default_NamedClass1"; var q1: number = new ES6_Def_NamedClass1().givesANum(); var q2: string = new ES6_Def_NamedClass1().givesANum(); -import doesntExist5 from \"ES6_Named1\"; -import { specifierNumber1 as specifierNumber1_1 } from \"ES6_Named1\"; +import doesntExist5 from "ES6_Named1"; +import { specifierNumber1 as specifierNumber1_1 } from "ES6_Named1"; var r1: number = specifierNumber1_1; var r2: string = specifierNumber1_1; -import { specifierNumber2Renamed } from \"ES6_Named1\"; +import { specifierNumber2Renamed } from "ES6_Named1"; var s1: number = specifierNumber2Renamed; var s2: string = specifierNumber2Renamed; -import { specifierNumber3 as specifierNumber3Renamed } from \"ES6_Named1\"; +import { specifierNumber3 as specifierNumber3Renamed } from "ES6_Named1"; var t1: number = specifierNumber3Renamed; var t2: string = specifierNumber3Renamed; -import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from \"ES6_Named1\"; +import { groupedSpecifierNumber1, groupedSpecifierNumber2 } from "ES6_Named1"; var u1: number = groupedSpecifierNumber1; var u2: number = groupedSpecifierNumber2; var u3: string = groupedSpecifierNumber1; var u4: string = groupedSpecifierNumber2; -import { givesANumber } from \"ES6_Named1\"; +import { givesANumber } from "ES6_Named1"; var v1: number = givesANumber(); var v2: string = givesANumber(); -import { NumberGenerator } from \"ES6_Named1\"; +import { NumberGenerator } from "ES6_Named1"; var w1: number = new NumberGenerator().givesANumber(); var w2: string = new NumberGenerator().givesANumber(); -import { varDeclNumber1, varDeclNumber2 } from \"ES6_Named1\"; +import { varDeclNumber1, varDeclNumber2 } from "ES6_Named1"; var x1: number = varDeclNumber1; var x2: number = varDeclNumber2; var x3: string = varDeclNumber1; var x4: string = varDeclNumber2; -import { destructuredObjNumber } from \"ES6_Named1\"; +import { destructuredObjNumber } from "ES6_Named1"; var y1: number = destructuredObjNumber; var y2: string = destructuredObjNumber; -import { destructuredArrNumber } from \"ES6_Named1\"; +import { destructuredArrNumber } from "ES6_Named1"; var z1: number = destructuredArrNumber; var z2: string = destructuredArrNumber; -import { numberValue1 as numberValue4 } from \"ES6_ExportFrom_Intermediary1\"; +import { numberValue1 as numberValue4 } from "ES6_ExportFrom_Intermediary1"; var aa1: number = numberValue4; var aa2: string = numberValue4; -import { numberValue2_renamed } from \"ES6_ExportFrom_Intermediary1\"; +import { numberValue2_renamed } from "ES6_ExportFrom_Intermediary1"; var ab1: number = numberValue2_renamed; var ab2: string = numberValue2_renamed; -import { numberValue1 as numberValue5 } from \"ES6_ExportAllFrom_Intermediary1\"; +import { numberValue1 as numberValue5 } from "ES6_ExportAllFrom_Intermediary1"; var ac1: number = numberValue5; var ac2: string = numberValue5; -require(\"ES6_Default_AnonFunction2\").doesntExist; -var ES6_Def_AnonFunc2 = require(\"ES6_Default_AnonFunction2\").default; +require("ES6_Default_AnonFunction2").doesntExist; +var ES6_Def_AnonFunc2 = require("ES6_Default_AnonFunction2").default; var ad1: number = ES6_Def_AnonFunc2(); var ad2: string = ES6_Def_AnonFunc2(); -var ES6_Def_NamedFunc2 = require(\"ES6_Default_NamedFunction2\").default; +var ES6_Def_NamedFunc2 = require("ES6_Default_NamedFunction2").default; var ae1: number = ES6_Def_NamedFunc2(); var ae2: string = ES6_Def_NamedFunc2(); -var ES6_Def_AnonClass2 = require(\"ES6_Default_AnonClass2\").default; +var ES6_Def_AnonClass2 = require("ES6_Default_AnonClass2").default; var af1: number = new ES6_Def_AnonClass2().givesANum(); var af2: string = new ES6_Def_AnonClass2().givesANum(); -var ES6_Def_NamedClass2 = require(\"ES6_Default_NamedClass2\").default; +var ES6_Def_NamedClass2 = require("ES6_Default_NamedClass2").default; var ag1: number = new ES6_Def_NamedClass2().givesANum(); var ag2: string = new ES6_Def_NamedClass2().givesANum(); -var specifierNumber4 = require(\"ES6_Named2\").specifierNumber4; +var specifierNumber4 = require("ES6_Named2").specifierNumber4; var ah1: number = specifierNumber4; var ah2: string = specifierNumber4; -var specifierNumber5Renamed = require(\"ES6_Named2\").specifierNumber5Renamed; +var specifierNumber5Renamed = require("ES6_Named2").specifierNumber5Renamed; var ai1: number = specifierNumber5Renamed; var ai2: string = specifierNumber5Renamed; -var groupedSpecifierNumber3 = require(\"ES6_Named2\").groupedSpecifierNumber3; -var groupedSpecifierNumber4 = require(\"ES6_Named2\").groupedSpecifierNumber4; +var groupedSpecifierNumber3 = require("ES6_Named2").groupedSpecifierNumber3; +var groupedSpecifierNumber4 = require("ES6_Named2").groupedSpecifierNumber4; var aj1: number = groupedSpecifierNumber3; var aj2: number = groupedSpecifierNumber4; var aj3: string = groupedSpecifierNumber3; var aj4: string = groupedSpecifierNumber4; -var givesANumber2 = require(\"ES6_Named2\").givesANumber2; +var givesANumber2 = require("ES6_Named2").givesANumber2; var ak1: number = givesANumber2(); var ak2: string = givesANumber2(); -var NumberGenerator2 = require(\"ES6_Named2\").NumberGenerator2; +var NumberGenerator2 = require("ES6_Named2").NumberGenerator2; var al1: number = new NumberGenerator2().givesANumber(); var al2: string = new NumberGenerator2().givesANumber(); -var varDeclNumber3 = require(\"ES6_Named2\").varDeclNumber3; -var varDeclNumber4 = require(\"ES6_Named2\").varDeclNumber4; +var varDeclNumber3 = require("ES6_Named2").varDeclNumber3; +var varDeclNumber4 = require("ES6_Named2").varDeclNumber4; var am1: number = varDeclNumber3; var am2: number = varDeclNumber4; var am3: string = varDeclNumber3; var am4: string = varDeclNumber4; -var destructuredObjNumber2 = require(\"ES6_Named2\").destructuredObjNumber2; +var destructuredObjNumber2 = require("ES6_Named2").destructuredObjNumber2; var an1: number = destructuredObjNumber2; var an2: string = destructuredObjNumber2; -var destructuredArrNumber2 = require(\"ES6_Named2\").destructuredArrNumber2; +var destructuredArrNumber2 = require("ES6_Named2").destructuredArrNumber2; var ao1: number = destructuredArrNumber2; var ao2: string = destructuredArrNumber2; -var numberValue6 = require(\"ES6_ExportFrom_Intermediary2\").numberValue1; +var numberValue6 = require("ES6_ExportFrom_Intermediary2").numberValue1; var ap1: number = numberValue6; var ap2: string = numberValue6; var numberValue2_renamed2 = require( - \"ES6_ExportFrom_Intermediary2\" + "ES6_ExportFrom_Intermediary2" ).numberValue2_renamed2; var aq1: number = numberValue2_renamed2; var aq2: string = numberValue2_renamed2; -var numberValue7 = require(\"ES6_ExportAllFrom_Intermediary2\").numberValue2; +var numberValue7 = require("ES6_ExportAllFrom_Intermediary2").numberValue2; var ar1: number = numberValue7; var ar2: string = numberValue7; -import defaultNum, { str as namedStr } from \"./ES6_DefaultAndNamed\"; +import defaultNum, { str as namedStr } from "./ES6_DefaultAndNamed"; var as1: number = defaultNum; var as2: string = defaultNum; var as3: string = namedStr; var as4: number = namedStr; -import \"./SideEffects\"; -import specifierNumber1 from \"ES6_Named1\"; -import { specifierNumber } from \"ES6_Named1\"; -import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from \"./ES6_ExportAllFromMulti\"; +import "./SideEffects"; +import specifierNumber1 from "ES6_Named1"; +import { specifierNumber } from "ES6_Named1"; +import { numberValue1 as numberValue8, numberValue2 as numberValue9 } from "./ES6_ExportAllFromMulti"; var at1: number = numberValue8; var at2: string = numberValue8; var at3: number = numberValue9; var at4: string = numberValue9; -import { typeAlias } from \"./ExportType\"; +import { typeAlias } from "./ExportType"; " `; @@ -1259,27 +1259,27 @@ exports[`test test_imports_are_frozen.js 1`] = ` // // CommonJS module -import * as DefaultA from \"A\"; +import * as DefaultA from "A"; DefaultA.numberValue1 = 123; // Error: DefaultA is frozen // ES6 module -import * as ES6_Named1 from \"ES6_Named1\"; +import * as ES6_Named1 from "ES6_Named1"; ES6_Named1.varDeclNumber1 = 123; // Error: ES6_Named1 is frozen // CommonJS module that clobbers module.exports -import * as CommonJS_Star from \"CommonJS_Clobbering_Lit\"; +import * as CommonJS_Star from "CommonJS_Clobbering_Lit"; CommonJS_Star.numberValue1 = 123; // Error: frozen CommonJS_Star.default.numberValue1 = 123; // ok -import CommonJS_Clobbering_Lit from \"CommonJS_Clobbering_Lit\"; +import CommonJS_Clobbering_Lit from "CommonJS_Clobbering_Lit"; CommonJS_Clobbering_Lit.numberValue1 = 123; // ok // CommonJS module that clobbers module.exports with a frozen object -import * as CommonJS_Frozen_Star from \"CommonJS_Clobbering_Frozen\"; +import * as CommonJS_Frozen_Star from "CommonJS_Clobbering_Frozen"; CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen CommonJS_Frozen_Star.default.numberValue1 = 123; // Error: frozen -import CommonJS_Clobbering_Frozen from \"CommonJS_Clobbering_Frozen\"; +import CommonJS_Clobbering_Frozen from "CommonJS_Clobbering_Frozen"; CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen @@ -1289,19 +1289,19 @@ CommonJS_Clobbering_Frozen.numberValue1 = 123; // Error: exports are frozen function testRequires() { // CommonJS module - var DefaultA = require(\"A\"); + var DefaultA = require("A"); DefaultA.numberValue1 = 123; // ok, not frozen by default // ES6 module - var ES6_Named1 = require(\"ES6_Named1\"); + var ES6_Named1 = require("ES6_Named1"); ES6_Named1.numberValue = 123; // error, es6 exports are frozen // CommonJS module that clobbers module.exports - var CommonJS_Star = require(\"CommonJS_Clobbering_Lit\"); + var CommonJS_Star = require("CommonJS_Clobbering_Lit"); CommonJS_Star.numberValue1 = 123; // ok, not frozen by default // CommonJS module that clobbers module.exports with a frozen object - var CommonJS_Frozen_Star = require(\"CommonJS_Clobbering_Frozen\"); + var CommonJS_Frozen_Star = require("CommonJS_Clobbering_Frozen"); CommonJS_Frozen_Star.numberValue1 = 123; // Error: frozen } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1332,28 +1332,28 @@ function testRequires() { // ok, not frozen by default // CommonJS module that clobbers module.exports with a frozen object // Error: frozen -import * as DefaultA from \"A\"; +import * as DefaultA from "A"; DefaultA.numberValue1 = 123; -import * as ES6_Named1 from \"ES6_Named1\"; +import * as ES6_Named1 from "ES6_Named1"; ES6_Named1.varDeclNumber1 = 123; -import * as CommonJS_Star from \"CommonJS_Clobbering_Lit\"; +import * as CommonJS_Star from "CommonJS_Clobbering_Lit"; CommonJS_Star.numberValue1 = 123; CommonJS_Star.default.numberValue1 = 123; -import CommonJS_Clobbering_Lit from \"CommonJS_Clobbering_Lit\"; +import CommonJS_Clobbering_Lit from "CommonJS_Clobbering_Lit"; CommonJS_Clobbering_Lit.numberValue1 = 123; -import * as CommonJS_Frozen_Star from \"CommonJS_Clobbering_Frozen\"; +import * as CommonJS_Frozen_Star from "CommonJS_Clobbering_Frozen"; CommonJS_Frozen_Star.numberValue1 = 123; CommonJS_Frozen_Star.default.numberValue1 = 123; -import CommonJS_Clobbering_Frozen from \"CommonJS_Clobbering_Frozen\"; +import CommonJS_Clobbering_Frozen from "CommonJS_Clobbering_Frozen"; CommonJS_Clobbering_Frozen.numberValue1 = 123; function testRequires() { - var DefaultA = require(\"A\"); + var DefaultA = require("A"); DefaultA.numberValue1 = 123; - var ES6_Named1 = require(\"ES6_Named1\"); + var ES6_Named1 = require("ES6_Named1"); ES6_Named1.numberValue = 123; - var CommonJS_Star = require(\"CommonJS_Clobbering_Lit\"); + var CommonJS_Star = require("CommonJS_Clobbering_Lit"); CommonJS_Star.numberValue1 = 123; - var CommonJS_Frozen_Star = require(\"CommonJS_Clobbering_Frozen\"); + var CommonJS_Frozen_Star = require("CommonJS_Clobbering_Frozen"); CommonJS_Frozen_Star.numberValue1 = 123; } " diff --git a/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap b/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap index d26b4cee3..5cc373afe 100644 --- a/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/es_declare_module/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test es_declare_module.js 1`] = ` "// @flow -import {num1, str1} from \"CJS_Named\"; -import CJS_Named from \"CJS_Named\"; +import {num1, str1} from "CJS_Named"; +import CJS_Named from "CJS_Named"; (num1: number); (num1: string); // Error: number ~> string (str1: string); @@ -10,36 +10,36 @@ import CJS_Named from \"CJS_Named\"; (CJS_Named: {num1: number, str1: string}); (CJS_Named: number); // Error: Module ~> number -import {num2} from \"CJS_Clobbered\"; // Error: No such export! -import {numExport} from \"CJS_Clobbered\"; +import {num2} from "CJS_Clobbered"; // Error: No such export! +import {numExport} from "CJS_Clobbered"; (numExport: number); (numExport: string); // Error: number ~> string -import type {numType} from \"CJS_Clobbered\"; +import type {numType} from "CJS_Clobbered"; (42: numType); -(\'asdf\': numType); // Error: string ~> number +('asdf': numType); // Error: string ~> number -import {strHidden} from \"ES\"; // Error: No such export! -import {str3} from \"ES\"; +import {strHidden} from "ES"; // Error: No such export! +import {str3} from "ES"; (str3: string); (str3: number); // Error: string ~> number -import {num3} from \"ES\"; +import {num3} from "ES"; (num3: number); (num3: string); // Error: number ~> string -import {C} from \"ES\"; -import type {C as CType} from \"ES\"; +import {C} from "ES"; +import type {C as CType} from "ES"; (new C(): C); (42: C); // Error: number ~> C (new C(): CType); (42: CType); // Error: number ~> CType -import {T} from \"ES\"; // Error: T is a type import, not a value -import type {T as T2} from \"ES\"; +import {T} from "ES"; // Error: T is a type import, not a value +import type {T as T2} from "ES"; (42: T2); -(\'asdf\': T2); // Error: string ~> number +('asdf': T2); // Error: string ~> number -import {exports as nope} from \"ES\"; // Error: Not an export +import {exports as nope} from "ES"; // Error: Not an export ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: number ~> string @@ -56,38 +56,38 @@ import {exports as nope} from \"ES\"; // Error: Not an export // Error: T is a type import, not a value // Error: string ~> number // Error: Not an export -import { num1, str1 } from \"CJS_Named\"; -import CJS_Named from \"CJS_Named\"; +import { num1, str1 } from "CJS_Named"; +import CJS_Named from "CJS_Named"; (num1: number); (num1: string); (str1: string); (str1: number); -(CJS_Named: { num1: number, str1: string }); +(CJS_Named: { num1: number; str1: string }); (CJS_Named: number); -import { num2 } from \"CJS_Clobbered\"; -import { numExport } from \"CJS_Clobbered\"; +import { num2 } from "CJS_Clobbered"; +import { numExport } from "CJS_Clobbered"; (numExport: number); (numExport: string); -import type { numType } from \"CJS_Clobbered\"; +import type { numType } from "CJS_Clobbered"; (42: numType); -(\"asdf\": numType); -import { strHidden } from \"ES\"; -import { str3 } from \"ES\"; +("asdf": numType); +import { strHidden } from "ES"; +import { str3 } from "ES"; (str3: string); (str3: number); -import { num3 } from \"ES\"; +import { num3 } from "ES"; (num3: number); (num3: string); -import { C } from \"ES\"; -import type { C as CType } from \"ES\"; +import { C } from "ES"; +import type { C as CType } from "ES"; (new C(): C); (42: C); (new C(): CType); (42: CType); -import { T } from \"ES\"; -import type { T as T2 } from \"ES\"; +import { T } from "ES"; +import type { T as T2 } from "ES"; (42: T2); -(\"asdf\": T2); -import { exports as nope } from \"ES\"; +("asdf": T2); +import { exports as nope } from "ES"; " `; diff --git a/tests/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap b/tests/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap index bde0efc93..cd56c445d 100644 --- a/tests/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/es_declare_module/flow-typed/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ exports[`test declares.js 1`] = ` -"declare module "CJS_Named" { +"declare module \"CJS_Named\" { declare var num1: number; declare var str1: string; } -declare module "CJS_Clobbered" { +declare module \"CJS_Clobbered\" { declare var num2: number; declare type numType = number; declare var exports: { @@ -12,7 +12,7 @@ declare module "CJS_Clobbered" { }; } -declare module "ES" { +declare module \"ES\" { declare var strHidden: string; declare export {strHidden as str3}; declare export var num3: number; @@ -21,16 +21,16 @@ declare module "ES" { declare var exports: number; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare module "CJS_Named" { +declare module \"CJS_Named\" { declare var num1: number; declare var str1: string; } -declare module "CJS_Clobbered" { +declare module \"CJS_Clobbered\" { declare var num2: number; - type numType = number; + declare type numType = number; declare var exports: { numExport: number }; } -declare module "ES" { +declare module \"ES\" { declare var strHidden: string; declare export { strHidden as str3 } declare export var num3: number; diff --git a/tests/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index bb223753c..000000000 --- a/tests/esproposal_class_instance_fields.ignore/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,20 +0,0 @@ -exports[`test test.js 1`] = ` -"/* @flow */ - -class Foo { - annotationOnly: string; - initOnly = 'asdf' - initWithAnnotation: string = 'asdf'; - [computed]: string; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -class Foo { - annotationOnly: string; - initOnly; - =(initWithAnnotation: string = "asdf", [ computed ], }) { - - } -} -" -`; diff --git a/tests/esproposal_class_instance_fields.ignore/jsfmt.spec.js b/tests/esproposal_class_instance_fields.ignore/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/esproposal_class_instance_fields.ignore/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/esproposal_class_instance_fields.ignore/test.js b/tests/esproposal_class_instance_fields.ignore/test.js deleted file mode 100644 index 7525cf355..000000000 --- a/tests/esproposal_class_instance_fields.ignore/test.js +++ /dev/null @@ -1,8 +0,0 @@ -/* @flow */ - -class Foo { - annotationOnly: string; - initOnly = 'asdf' - initWithAnnotation: string = 'asdf'; - [computed]: string; -} diff --git a/tests/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 133e36703..000000000 --- a/tests/esproposal_class_instance_fields.warn/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,19 +0,0 @@ -exports[`test test.js 1`] = ` -"/* @flow */ - -class Foo { - annotationOnly: string; - initOnly = 'asdf'; - initWithAnnotation: string = 'asdf'; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -class Foo { - annotationOnly: string; - initOnly; - =(;, :, =, ;) { - - } -} -" -`; diff --git a/tests/esproposal_class_instance_fields.warn/jsfmt.spec.js b/tests/esproposal_class_instance_fields.warn/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/esproposal_class_instance_fields.warn/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/esproposal_class_instance_fields.warn/test.js b/tests/esproposal_class_instance_fields.warn/test.js deleted file mode 100644 index ac74ba3e8..000000000 --- a/tests/esproposal_class_instance_fields.warn/test.js +++ /dev/null @@ -1,7 +0,0 @@ -/* @flow */ - -class Foo { - annotationOnly: string; - initOnly = 'asdf'; - initWithAnnotation: string = 'asdf'; -} diff --git a/tests/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index fa3c46f95..000000000 --- a/tests/esproposal_class_static_fields.ignore/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,19 +0,0 @@ -exports[`test test.js 1`] = ` -"/* @flow */ - -class Foo { - static annotationOnly: string; - static initOnly = 'asdf'; - static initWithAnnotation: string = 'asdf'; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -class Foo { - static annotationOnly: string; - static initOnly; - =(;, initWithAnnotation: string = "asdf", }) { - - } -} -" -`; diff --git a/tests/esproposal_class_static_fields.ignore/jsfmt.spec.js b/tests/esproposal_class_static_fields.ignore/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/esproposal_class_static_fields.ignore/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/esproposal_class_static_fields.ignore/test.js b/tests/esproposal_class_static_fields.ignore/test.js deleted file mode 100644 index f47f1b642..000000000 --- a/tests/esproposal_class_static_fields.ignore/test.js +++ /dev/null @@ -1,7 +0,0 @@ -/* @flow */ - -class Foo { - static annotationOnly: string; - static initOnly = 'asdf'; - static initWithAnnotation: string = 'asdf'; -} diff --git a/tests/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index fa3c46f95..000000000 --- a/tests/esproposal_class_static_fields.warn/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,19 +0,0 @@ -exports[`test test.js 1`] = ` -"/* @flow */ - -class Foo { - static annotationOnly: string; - static initOnly = 'asdf'; - static initWithAnnotation: string = 'asdf'; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -class Foo { - static annotationOnly: string; - static initOnly; - =(;, initWithAnnotation: string = "asdf", }) { - - } -} -" -`; diff --git a/tests/esproposal_class_static_fields.warn/jsfmt.spec.js b/tests/esproposal_class_static_fields.warn/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/esproposal_class_static_fields.warn/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/esproposal_class_static_fields.warn/test.js b/tests/esproposal_class_static_fields.warn/test.js deleted file mode 100644 index f47f1b642..000000000 --- a/tests/esproposal_class_static_fields.warn/test.js +++ /dev/null @@ -1,7 +0,0 @@ -/* @flow */ - -class Foo { - static annotationOnly: string; - static initOnly = 'asdf'; - static initWithAnnotation: string = 'asdf'; -} diff --git a/tests/esproposal_decorators.ignore/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_decorators.ignore/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 1e635afd5..000000000 --- a/tests/esproposal_decorators.ignore/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,24 +0,0 @@ -exports[`test test.js 1`] = ` -"/* @flow */ - -@decorator4 -class Foo { - @decorator1 - method1() {} - - @decorator2 - @decorator3 - method2() {} -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -class decorator4 { - Foo(@, method1) { - - } - @(@, method2) { - - } -} -" -`; diff --git a/tests/esproposal_decorators.ignore/jsfmt.spec.js b/tests/esproposal_decorators.ignore/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/esproposal_decorators.ignore/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/esproposal_decorators.ignore/test.js b/tests/esproposal_decorators.ignore/test.js deleted file mode 100644 index 972036955..000000000 --- a/tests/esproposal_decorators.ignore/test.js +++ /dev/null @@ -1,11 +0,0 @@ -/* @flow */ - -@decorator4 -class Foo { - @decorator1 - method1() {} - - @decorator2 - @decorator3 - method2() {} -} diff --git a/tests/esproposal_decorators.warn/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_decorators.warn/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 1e635afd5..000000000 --- a/tests/esproposal_decorators.warn/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,24 +0,0 @@ -exports[`test test.js 1`] = ` -"/* @flow */ - -@decorator4 -class Foo { - @decorator1 - method1() {} - - @decorator2 - @decorator3 - method2() {} -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -class decorator4 { - Foo(@, method1) { - - } - @(@, method2) { - - } -} -" -`; diff --git a/tests/esproposal_decorators.warn/jsfmt.spec.js b/tests/esproposal_decorators.warn/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/esproposal_decorators.warn/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/esproposal_decorators.warn/test.js b/tests/esproposal_decorators.warn/test.js deleted file mode 100644 index 972036955..000000000 --- a/tests/esproposal_decorators.warn/test.js +++ /dev/null @@ -1,11 +0,0 @@ -/* @flow */ - -@decorator4 -class Foo { - @decorator1 - method1() {} - - @decorator2 - @decorator3 - method2() {} -} diff --git a/tests/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap index a4cf1b3f6..9fbb68334 100644 --- a/tests/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/esproposal_export_star_as.enable/__snapshots__/jsfmt.spec.js.snap @@ -31,15 +31,3 @@ export var str = \"asdf\"; export var num = 42; " `; - -exports[`test test.js 1`] = ` -"// @flow - -export * as source from \"./source\"; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -export * from \"from\" -from; -\"./source\"; -" -`; diff --git a/tests/esproposal_export_star_as.enable/test.js b/tests/esproposal_export_star_as.enable/test.js deleted file mode 100644 index 5fdc12729..000000000 --- a/tests/esproposal_export_star_as.enable/test.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow - -export * as source from "./source"; diff --git a/tests/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap index b0d3b32ca..dde9e4035 100644 --- a/tests/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap +++ b/tests/esproposal_export_star_as.ignore/__snapshots__/jsfmt.spec.js.snap @@ -31,15 +31,3 @@ export var str = \"asdf\"; export var num = 42; " `; - -exports[`test test.js 1`] = ` -"// @flow - -export * as source from \"./source\"; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -export * from \"from\" -from; -\"./source\"; -" -`; diff --git a/tests/esproposal_export_star_as.ignore/test.js b/tests/esproposal_export_star_as.ignore/test.js deleted file mode 100644 index 5fdc12729..000000000 --- a/tests/esproposal_export_star_as.ignore/test.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow - -export * as source from "./source"; diff --git a/tests/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap b/tests/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index a06c21ff1..000000000 --- a/tests/esproposal_export_star_as.warn/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,11 +0,0 @@ -exports[`test test.js 1`] = ` -"/* @flow */ - -export * as foo from "./test"; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -export * from "from" -from; -"./test"; -" -`; diff --git a/tests/esproposal_export_star_as.warn/jsfmt.spec.js b/tests/esproposal_export_star_as.warn/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/esproposal_export_star_as.warn/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/esproposal_export_star_as.warn/test.js b/tests/esproposal_export_star_as.warn/test.js deleted file mode 100644 index ee71a9b84..000000000 --- a/tests/esproposal_export_star_as.warn/test.js +++ /dev/null @@ -1,3 +0,0 @@ -/* @flow */ - -export * as foo from "./test"; diff --git a/tests/export_type/__snapshots__/jsfmt.spec.js.snap b/tests/export_type/__snapshots__/jsfmt.spec.js.snap index 1496d5138..e37467805 100644 --- a/tests/export_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/export_type/__snapshots__/jsfmt.spec.js.snap @@ -8,7 +8,7 @@ module.exports = {} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ export type talias4 = number; -export interface IFoo extends { prop: number } +export interface IFoo { prop: number } module.exports = {}; " `; @@ -21,30 +21,30 @@ import type { standaloneType1, talias1, talias3, -} from \"./types_only\"; +} from "./types_only"; var a: inlinedType1 = 42; -var b: inlinedType1 = \'asdf\'; // Error: string ~> number +var b: inlinedType1 = 'asdf'; // Error: string ~> number var c: standaloneType1 = 42; -var d: standaloneType1 = \'asdf\'; // Error: string ~> number +var d: standaloneType1 = 'asdf'; // Error: string ~> number var e: talias1 = 42; -var f: talias1 = \'asdf\'; // Error: string ~> number +var f: talias1 = 'asdf'; // Error: string ~> number var g: talias3 = 42; -var h: talias3 = \'asdf\'; // Error: string ~> number +var h: talias3 = 'asdf'; // Error: string ~> number -import type {talias4} from \"./cjs_with_types\"; +import type {talias4} from "./cjs_with_types"; var i: talias4 = 42; -var j: talias4 = \'asdf\'; // Error: string ~> number +var j: talias4 = 'asdf'; // Error: string ~> number -import {IFoo, IFoo2} from \"./types_only\"; +import {IFoo, IFoo2} from "./types_only"; var k: IFoo = {prop: 42}; -var l: IFoo = {prop: \'asdf\'}; // Error: {prop:string} ~> {prop:number} +var l: IFoo = {prop: 'asdf'}; // Error: {prop:string} ~> {prop:number} -var m: IFoo2 = {prop: \'asdf\'}; +var m: IFoo2 = {prop: 'asdf'}; var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -55,22 +55,22 @@ var n: IFoo2 = {prop: 42}; // Error: {prop:number} ~> {prop:string} // Error: string ~> number // Error: {prop:string} ~> {prop:number} // Error: {prop:number} ~> {prop:string} -import type { inlinedType1, standaloneType1, talias1, talias3 } from \"./types_only\"; +import type { inlinedType1, standaloneType1, talias1, talias3 } from "./types_only"; var a: inlinedType1 = 42; -var b: inlinedType1 = \"asdf\"; +var b: inlinedType1 = "asdf"; var c: standaloneType1 = 42; -var d: standaloneType1 = \"asdf\"; +var d: standaloneType1 = "asdf"; var e: talias1 = 42; -var f: talias1 = \"asdf\"; +var f: talias1 = "asdf"; var g: talias3 = 42; -var h: talias3 = \"asdf\"; -import type { talias4 } from \"./cjs_with_types\"; +var h: talias3 = "asdf"; +import type { talias4 } from "./cjs_with_types"; var i: talias4 = 42; -var j: talias4 = \"asdf\"; -import { IFoo, IFoo2 } from \"./types_only\"; +var j: talias4 = "asdf"; +import { IFoo, IFoo2 } from "./types_only"; var k: IFoo = { prop: 42 }; -var l: IFoo = { prop: \"asdf\" }; -var m: IFoo2 = { prop: \"asdf\" }; +var l: IFoo = { prop: "asdf" }; +var m: IFoo2 = { prop: "asdf" }; var n: IFoo2 = { prop: 42 }; " `; @@ -80,7 +80,7 @@ exports[`test types_only.js 1`] = ` export type inlinedType1 = number; var a: inlinedType1 = 42; -var b: inlinedType1 = \'asdf\'; // Error: string ~> number +var b: inlinedType1 = 'asdf'; // Error: string ~> number type standaloneType1 = number; export type {standaloneType1}; @@ -88,7 +88,7 @@ export type {standaloneType1}; type standaloneType2 = number; export {standaloneType2}; // Error: Missing \`type\` keyword -export type {talias1, talias2 as talias3, IFoo2} from \"./types_only2\"; +export type {talias1, talias2 as talias3, IFoo2} from "./types_only2"; export interface IFoo { prop: number }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,13 +97,13 @@ export interface IFoo { prop: number }; // Error: Missing \`type\` keyword export type inlinedType1 = number; var a: inlinedType1 = 42; -var b: inlinedType1 = \"asdf\"; +var b: inlinedType1 = "asdf"; type standaloneType1 = number; export { standaloneType1 } type standaloneType2 = number; export { standaloneType2 } -export { talias1, talias2 as talias3, IFoo2 } from \"./types_only2\" -export interface IFoo extends { prop: number } +export { talias1, talias2 as talias3, IFoo2 } from "./types_only2" +export interface IFoo { prop: number } " `; @@ -117,6 +117,6 @@ export interface IFoo2 { prop: string }; /* @flow */ export type talias1 = number; export type talias2 = number; -export interface IFoo2 extends { prop: string } +export interface IFoo2 { prop: string } " `; diff --git a/tests/extensions/__snapshots__/jsfmt.spec.js.snap b/tests/extensions/__snapshots__/jsfmt.spec.js.snap index 524d171e6..fff08926c 100644 --- a/tests/extensions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/extensions/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test foo.js 1`] = ` -"var imp = require(\'./bar\'); +"var imp = require('./bar'); imp(1337); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var imp = require(\"./bar\"); +var imp = require("./bar"); imp(1337); " `; diff --git a/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap b/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap index 50e29459d..0fdd701ad 100644 --- a/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap +++ b/tests/facebookisms/__snapshots__/jsfmt.spec.js.snap @@ -22,15 +22,15 @@ let tests = [ result.baz = false; (copyProperties( result, - { foo: \'a\' }, + { foo: 'a' }, { bar: 123 } ): { foo: string, bar: number, baz: boolean }); }, // module from lib function() { - const copyProperties = require(\'copyProperties\'); - let x = { foo: \'a\' }; + const copyProperties = require('copyProperties'); + let x = { foo: 'a' }; let y = { bar: 123 }; (copyProperties({}, x, y): { foo: string, bar: number }); }, @@ -38,7 +38,7 @@ let tests = [ // too few args function(copyProperties: Object$Assign) { copyProperties(); - (copyProperties({ foo: \'a\' }): { foo: number }); // err, num !~> string + (copyProperties({ foo: 'a' }): { foo: number }); // err, num !~> string }, // passed as a function @@ -63,21 +63,21 @@ let tests = [ function(copyProperties: Object$Assign) { let result = {}; result.baz = false; - (copyProperties(result, { foo: \"a\" }, { bar: 123 }): { - foo: string, - bar: number, + (copyProperties(result, { foo: "a" }, { bar: 123 }): { + foo: string; + bar: number; baz: boolean }); }, function() { - const copyProperties = require(\"copyProperties\"); - let x = { foo: \"a\" }; + const copyProperties = require("copyProperties"); + let x = { foo: "a" }; let y = { bar: 123 }; - (copyProperties({}, x, y): { foo: string, bar: number }); + (copyProperties({}, x, y): { foo: string; bar: number }); }, function(copyProperties: Object$Assign) { copyProperties(); - (copyProperties({ foo: \"a\" }): { foo: number }); + (copyProperties({ foo: "a" }): { foo: number }); }, function(copyProperties: Object$Assign) { function x(cb: Function) { @@ -95,7 +95,7 @@ exports[`test invariant.js 1`] = ` let tests = [ function() { let x: ?string = null; - invariant(x, \'truthy only\'); // error, forgot to require invariant + invariant(x, 'truthy only'); // error, forgot to require invariant }, function(invariant: Function) { @@ -110,7 +110,7 @@ let tests = [ let tests = [ function() { let x: ?string = null; - invariant(x, \"truthy only\"); + invariant(x, "truthy only"); }, function(invariant: Function) { let x: ?string = null; @@ -122,25 +122,25 @@ let tests = [ `; exports[`test lib.js 1`] = ` -"declare module \"copyProperties\" { +"declare module "copyProperties" { declare var exports: Object$Assign; } -declare module \"mergeInto\" { +declare module "mergeInto" { declare var exports: $Facebookism$MergeInto; } -declare module \"mixin\" { +declare module "mixin" { declare var exports: $Facebookism$Mixin; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare module \"copyProperties\" { +declare module "copyProperties" { declare var exports: Object$Assign; } -declare module \"mergeInto\" { +declare module "mergeInto" { declare var exports: $Facebookism$MergeInto; } -declare module \"mixin\" { +declare module "mixin" { declare var exports: $Facebookism$Mixin; } " @@ -159,15 +159,15 @@ let tests = [ function(mergeInto: $Facebookism$MergeInto) { let result = {}; result.baz = false; - (mergeInto(result, { foo: \'a\' }, { bar: 123 }): void); + (mergeInto(result, { foo: 'a' }, { bar: 123 }): void); (result: { foo: string, bar: number, baz: boolean }); }, // module from lib function() { - const mergeInto = require(\'mergeInto\'); + const mergeInto = require('mergeInto'); let result: { foo?: string, bar?: number, baz: boolean } = { baz: false }; - (mergeInto(result, { foo: \'a\' }, { bar: 123 }): void); + (mergeInto(result, { foo: 'a' }, { bar: 123 }): void); }, // too few args @@ -196,13 +196,13 @@ let tests = [ function(mergeInto: $Facebookism$MergeInto) { let result = {}; result.baz = false; - (mergeInto(result, { foo: \"a\" }, { bar: 123 }): void); - (result: { foo: string, bar: number, baz: boolean }); + (mergeInto(result, { foo: "a" }, { bar: 123 }): void); + (result: { foo: string; bar: number; baz: boolean }); }, function() { - const mergeInto = require(\"mergeInto\"); - let result: { foo?: string, bar?: number, baz: boolean } = { baz: false }; - (mergeInto(result, { foo: \"a\" }, { bar: 123 }): void); + const mergeInto = require("mergeInto"); + let result: { foo?: string; bar?: number; baz: boolean } = { baz: false }; + (mergeInto(result, { foo: "a" }, { bar: 123 }): void); }, function(mergeInto: $Facebookism$MergeInto) { mergeInto(); @@ -218,22 +218,22 @@ let tests = [ `; exports[`test test.js 1`] = ` -"var Bar = require(\'./Bar\'); -var mixin = require(\'mixin\'); +"var Bar = require('./Bar'); +var mixin = require('mixin'); class Foo extends mixin(Bar) { m() { var x: string = this.x; - this.y = \"\"; + this.y = ""; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var Bar = require(\"./Bar\"); -var mixin = require(\"mixin\"); +var Bar = require("./Bar"); +var mixin = require("mixin"); class Foo extends mixin(Bar) { m() { var x: string = this.x; - this.y = \"\"; + this.y = ""; } } " diff --git a/tests/fetch/__snapshots__/jsfmt.spec.js.snap b/tests/fetch/__snapshots__/jsfmt.spec.js.snap index 22ef3c35d..ba33da5ef 100644 --- a/tests/fetch/__snapshots__/jsfmt.spec.js.snap +++ b/tests/fetch/__snapshots__/jsfmt.spec.js.snap @@ -108,10 +108,10 @@ const f: Headers = e.append(\"Content-Type\", \"image/jpeg\"); const g: string = e.get(\"Content-Type\"); const h: number = e.get(\"Content-Type\"); for (let v of e) { - const [ i, j ] = v; + const [ i, j ]: [string, string] = v; } for (let v of e.entries()) { - const [ i, j ] = v; + const [ i, j ]: [string, string] = v; } e.getAll(\"content-type\").forEach( (v: string) => { @@ -397,10 +397,10 @@ const f: URLSearchParams = e.append(\"key1\", \"value1\"); const g: string = e.get(\"key1\"); const h: number = e.get(\"key1\"); for (let v of e) { - const [ i, j ] = v; + const [ i, j ]: [string, string] = v; } for (let v of e.entries()) { - const [ i, j ] = v; + const [ i, j ]: [string, string] = v; } e.getAll(\"key1\").forEach( (v: string) => { diff --git a/tests/find-module/__snapshots__/jsfmt.spec.js.snap b/tests/find-module/__snapshots__/jsfmt.spec.js.snap index 3a5cd0262..2a5d7b4d3 100644 --- a/tests/find-module/__snapshots__/jsfmt.spec.js.snap +++ b/tests/find-module/__snapshots__/jsfmt.spec.js.snap @@ -6,13 +6,13 @@ module.exports = 0; `; exports[`test test.js 1`] = ` -"var x = require(\'./req\'); +"var x = require('./req'); (x: string); -import x from \'./req\'; +import x from './req'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var x = require(\"./req\"); +var x = require("./req"); (x: string); -import x from \"./req\"; +import x from "./req"; " `; diff --git a/tests/find-refs/__snapshots__/jsfmt.spec.js.snap b/tests/find-refs/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index ebc5a3cce..000000000 --- a/tests/find-refs/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,115 +0,0 @@ -exports[`test locals.js 1`] = ` -"// @flow - -// Variable defs and uses -var foo = function() { }; -foo(); -foo = null; -foo(); - -// Nested functions -function bar() { - function bar() { - } - bar(); -} -bar(); - -// Classes -class C { } -new C; -class D extends C { } - -// Type aliases -type T = number; -type S = T; -((_: T) => {}); - -// Refinements -let nullable: ?string = \"\"; -if (nullable != null) { - console.log(nullable.length); - nullable = null; -} -(nullable: null); - -// Destructuring -let { x, y } = { x: 0, y: 0 }; -let { x: _x, y: _y } = { x, y }; -({ x: _x, y: _y }); - -// Not in scope -wut1; -wut1 = wut2; -wut2; - -// JSX -var React = require(\'react\'); -class Fancy extends React.Component { - props: { x: number }; -} -; - -// Imports -import { wut3 } from \'wutland\'; -import type { wut4 } from \'wutland\'; -(wut3: wut4); - -// Qualified types -(null: React.Component); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -// Variable defs and uses -// Nested functions -// Classes -// Type aliases -// Refinements -// Destructuring -// Not in scope -// JSX -// Imports -// Qualified types -var foo = function() { - -}; -foo(); -foo = null; -foo(); -function bar() { - function bar() { - - } - bar(); -} -bar(); -class C {} -new C(); -class D extends C {} -type T = number; -type S = T; -(_: T) => { - -}; -let nullable: ?string = \"\"; -if (nullable != null) { - console.log(nullable.length); - nullable = null; -} -(nullable: null); -let { x, y } = { x: 0, y: 0 }; -let { x: _x, y: _y } = { x, y }; -({ x: _x, y: _y }); -wut1; -wut1 = wut2; -wut2; -var React = require(\"react\"); -class Fancy extends React.Component { - props: { x: number }; -} -; -import { wut3 } from \"wutland\"; -import type { wut4 } from \"wutland\"; -(wut3: wut4); -(null: React.Component); -" -`; diff --git a/tests/find-refs/jsfmt.spec.js b/tests/find-refs/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/find-refs/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/find-refs/locals.js b/tests/find-refs/locals.js deleted file mode 100644 index 5651166c1..000000000 --- a/tests/find-refs/locals.js +++ /dev/null @@ -1,58 +0,0 @@ -// @flow - -// Variable defs and uses -var foo = function() { }; -foo(); -foo = null; -foo(); - -// Nested functions -function bar() { - function bar() { - } - bar(); -} -bar(); - -// Classes -class C { } -new C; -class D extends C { } - -// Type aliases -type T = number; -type S = T; -((_: T) => {}); - -// Refinements -let nullable: ?string = ""; -if (nullable != null) { - console.log(nullable.length); - nullable = null; -} -(nullable: null); - -// Destructuring -let { x, y } = { x: 0, y: 0 }; -let { x: _x, y: _y } = { x, y }; -({ x: _x, y: _y }); - -// Not in scope -wut1; -wut1 = wut2; -wut2; - -// JSX -var React = require('react'); -class Fancy extends React.Component { - props: { x: number }; -} -; - -// Imports -import { wut3 } from 'wutland'; -import type { wut4 } from 'wutland'; -(wut3: wut4); - -// Qualified types -(null: React.Component); diff --git a/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap b/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap index ce3d432b5..2077ae5f7 100644 --- a/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap +++ b/tests/fixpoint/__snapshots__/jsfmt.spec.js.snap @@ -26,7 +26,7 @@ function mk_factorial() { var factorial = mk_factorial(); -factorial(\"...\"); +factorial("..."); module.exports = {fn: fix}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -64,7 +64,7 @@ function mk_factorial() { ); } var factorial = mk_factorial(); -factorial(\"...\"); +factorial("..."); module.exports = { fn: fix }; " `; diff --git a/tests/for/__snapshots__/jsfmt.spec.js.snap b/tests/for/__snapshots__/jsfmt.spec.js.snap index 71d3dcdd9..0ec90a036 100644 --- a/tests/for/__snapshots__/jsfmt.spec.js.snap +++ b/tests/for/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ function foo(x: boolean) { } return; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function bar(x: boolean) { @@ -17,7 +17,7 @@ function bar(x: boolean) { for (var ii = 0; ii < max; ii++) { return; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function baz(x: boolean) { @@ -25,7 +25,7 @@ function baz(x: boolean) { for (var ii = 0; ii < max; ii++) { continue; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function bliffl(x: boolean) { @@ -34,9 +34,9 @@ function bliffl(x: boolean) { loop2: for (var jj = 0; jj < max; jj++) { break loop1; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function corge(x: boolean) { @@ -44,7 +44,7 @@ function corge(x: boolean) { for (var ii = 0; ii < max; ii++) { break; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ @@ -56,21 +56,21 @@ function foo(x: boolean) { } return; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function bar(x: boolean) { var max = 0; for (var ii = 0; ii < max; ii++) { return; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function baz(x: boolean) { var max = 0; for (var ii = 0; ii < max; ii++) { continue; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function bliffl(x: boolean) { var max = 10; @@ -80,16 +80,16 @@ for (var ii = 0; ii < max; ii++) { for (var jj = 0; jj < max; jj++) { break loop1; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function corge(x: boolean) { var max = 0; for (var ii = 0; ii < max; ii++) { break; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } " `; @@ -103,21 +103,21 @@ exports[`test abnormal_for_in.js 1`] = ` } return; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function bar(x: boolean) { for (var prop in {}) { return; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function baz(x: boolean) { for (var prop in {}) { continue; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function bliffl(x: boolean) { @@ -126,16 +126,16 @@ function bliffl(x: boolean) { loop2: for (var prop2 in obj) { break loop1; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function corge(x: boolean) { for (var prop in {}) { break; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: boolean) { @@ -146,19 +146,19 @@ function foo(x: boolean) { } return; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function bar(x: boolean) { for (var prop in {}) { return; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function baz(x: boolean) { for (var prop in {}) { continue; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function bliffl(x: boolean) { var obj = { a: 1, b: 2 }; @@ -168,15 +168,15 @@ for (var prop1 in obj) { for (var prop2 in obj) { break loop1; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function corge(x: boolean) { for (var prop in {}) { break; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } " `; @@ -190,21 +190,21 @@ exports[`test abnormal_for_of.js 1`] = ` } return; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function bar(x: boolean) { for (var elem of []) { return; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function baz(x: boolean) { for (var elem of []) { continue; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function bliffl(x: boolean) { @@ -213,16 +213,16 @@ function bliffl(x: boolean) { loop2: for (var elem of arr) { break loop1; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } function corge(x: boolean) { for (var elem of []) { break; } - console.log(\'this is still reachable\'); + console.log('this is still reachable'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: boolean) { @@ -233,19 +233,19 @@ function foo(x: boolean) { } return; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function bar(x: boolean) { for (var elem of [ ]) { return; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function baz(x: boolean) { for (var elem of [ ]) { continue; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function bliffl(x: boolean) { var arr = [ 1, 2, 3 ]; @@ -255,15 +255,15 @@ for (var elem of arr) { for (var elem of arr) { break loop1; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } function corge(x: boolean) { for (var elem of [ ]) { break; } - console.log(\"this is still reachable\"); + console.log("this is still reachable"); } " `; diff --git a/tests/forof/__snapshots__/jsfmt.spec.js.snap b/tests/forof/__snapshots__/jsfmt.spec.js.snap index f51e7ce1a..0652bf642 100644 --- a/tests/forof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/forof/__snapshots__/jsfmt.spec.js.snap @@ -86,13 +86,13 @@ function testString(str: string): void { } function testMap1(map: Map): void { for (var elem of map) { - (elem: [stringnumber]); + (elem: [string, number]); (elem: number); } } function testMap2(map: Map<*, *>): void { for (var elem of map) { - (elem: [numberstring]); + (elem: [number, string]); (elem: number); } } diff --git a/tests/generators/__snapshots__/jsfmt.spec.js.snap b/tests/generators/__snapshots__/jsfmt.spec.js.snap index cd6b604cd..f2de7b0a3 100644 --- a/tests/generators/__snapshots__/jsfmt.spec.js.snap +++ b/tests/generators/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test class.js 1`] = ` "class GeneratorExamples { *stmt_yield(): Generator { yield 0; // ok - yield \"\"; // error: string ~> number + yield ""; // error: string ~> number } *stmt_next(): Generator { @@ -22,18 +22,18 @@ exports[`test class.js 1`] = ` } *stmt_return_err(): Generator { - return \"\"; // error: string ~> number + return ""; // error: string ~> number } *infer_stmt() { var x: boolean = yield 0; // error: number ~> boolean - return \"\"; + return ""; } *widen_next() { var x = yield 0; - if (typeof x === \"number\") { - } else if (typeof x === \"boolean\") { + if (typeof x === "number") { + } else if (typeof x === "boolean") { } else { (x : string) // ok, sherlock } @@ -41,7 +41,7 @@ exports[`test class.js 1`] = ` *widen_yield() { yield 0; - yield \"\"; + yield ""; yield true; } @@ -54,7 +54,7 @@ exports[`test class.js 1`] = ` *delegate_yield_generator() { function *inner() { - yield \"\"; + yield ""; } yield *inner(); @@ -62,7 +62,7 @@ exports[`test class.js 1`] = ` *delegate_return_generator() { function *inner() { - return \"\"; + return ""; } var x: number = yield *inner(); // error: string ~> number @@ -99,31 +99,31 @@ var examples = new GeneratorExamples(); for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean -if (typeof infer_stmt_next === \"undefined\") { -} else if (typeof infer_stmt_next === \"number\") { +if (typeof infer_stmt_next === "undefined") { +} else if (typeof infer_stmt_next === "number") { } else { (infer_stmt_next : boolean) // error: string ~> boolean } examples.widen_next().next(0) -examples.widen_next().next(\"\") +examples.widen_next().next("") examples.widen_next().next(true) for (var x of examples.widen_yield()) { - if (typeof x === \"number\") { - } else if (typeof x === \"boolean\") { + if (typeof x === "number") { + } else if (typeof x === "boolean") { } else { (x : string) // ok, sherlock } } -examples.delegate_next_generator().next(\"\"); +examples.delegate_next_generator().next(""); for (var x of examples.delegate_yield_generator()) { (x : number) // error: string ~> number } -examples.delegate_next_iterable([]).next(\"\"); // error: Iterator has no next value +examples.delegate_next_iterable([]).next(""); // error: Iterator has no next value for (var x of examples.delegate_yield_iterable([])) { (x : string) // error: number ~> string @@ -151,7 +151,7 @@ for (var x of examples.delegate_yield_iterable([])) { class GeneratorExamples { *stmt_yield(): Generator { yield 0; - yield \"\"; + yield ""; } *stmt_next(): Generator { var a = yield; @@ -167,18 +167,18 @@ class GeneratorExamples { return 0; } *stmt_return_err(): Generator { - return \"\"; + return ""; } *infer_stmt() { var x: boolean = yield 0; - return \"\"; + return ""; } *widen_next() { var x = yield 0; - if (typeof x === \"number\") { + if (typeof x === "number") { } else - if (typeof x === \"boolean\") { + if (typeof x === "boolean") { } else { (x: string); @@ -186,7 +186,7 @@ class GeneratorExamples { } *widen_yield() { yield 0; - yield \"\"; + yield ""; yield true; } *delegate_next_generator() { @@ -197,13 +197,13 @@ class GeneratorExamples { } *delegate_yield_generator() { function* inner() { - yield \"\"; + yield ""; } yield* inner(); } *delegate_return_generator() { function* inner() { - return \"\"; + return ""; } var x: number = yield* inner(); } @@ -231,32 +231,32 @@ for (var x of examples.infer_stmt()) { (x: string); } var infer_stmt_next = examples.infer_stmt().next(0).value; -if (typeof infer_stmt_next === \"undefined\") { +if (typeof infer_stmt_next === "undefined") { } else - if (typeof infer_stmt_next === \"number\") { + if (typeof infer_stmt_next === "number") { } else { (infer_stmt_next: boolean); } examples.widen_next().next(0); -examples.widen_next().next(\"\"); +examples.widen_next().next(""); examples.widen_next().next(true); for (var x of examples.widen_yield()) { - if (typeof x === \"number\") { + if (typeof x === "number") { } else - if (typeof x === \"boolean\") { + if (typeof x === "boolean") { } else { (x: string); } } -examples.delegate_next_generator().next(\"\"); +examples.delegate_next_generator().next(""); for (var x of examples.delegate_yield_generator()) { (x: number); } -examples.delegate_next_iterable([ ]).next(\"\"); +examples.delegate_next_iterable([ ]).next(""); for (var x of examples.delegate_yield_iterable([ ])) { (x: string); } @@ -269,7 +269,7 @@ exports[`test class_failure.js 1`] = ` class GeneratorExamples { *infer_stmt() { var x: boolean = yield 0; // error: number ~> boolean - return \"\"; + return ""; } } @@ -279,8 +279,8 @@ for (var x of examples.infer_stmt()) { (x : string) } // error: number ~> string var infer_stmt_next = examples.infer_stmt().next(0).value; // error: number ~> boolean -if (typeof infer_stmt_next === \"undefined\") { -} else if (typeof infer_stmt_next === \"number\") { +if (typeof infer_stmt_next === "undefined") { +} else if (typeof infer_stmt_next === "number") { } else { (infer_stmt_next : boolean) // error: string ~> boolean } @@ -293,7 +293,7 @@ if (typeof infer_stmt_next === \"undefined\") { class GeneratorExamples { *infer_stmt() { var x: boolean = yield 0; - return \"\"; + return ""; } } var examples = new GeneratorExamples(); @@ -301,10 +301,10 @@ for (var x of examples.infer_stmt()) { (x: string); } var infer_stmt_next = examples.infer_stmt().next(0).value; -if (typeof infer_stmt_next === \"undefined\") { +if (typeof infer_stmt_next === "undefined") { } else - if (typeof infer_stmt_next === \"number\") { + if (typeof infer_stmt_next === "number") { } else { (infer_stmt_next: boolean); @@ -315,7 +315,7 @@ if (typeof infer_stmt_next === \"undefined\") { exports[`test generators.js 1`] = ` "function *stmt_yield(): Generator { yield 0; // ok - yield \"\"; // error: string ~> number + yield ""; // error: string ~> number } function *stmt_next(): Generator { @@ -335,41 +335,41 @@ function *stmt_return_ok(): Generator { } function *stmt_return_err(): Generator { - return \"\"; // error: string ~> number + return ""; // error: string ~> number } function *infer_stmt() { var x: boolean = yield 0; - return \"\"; + return ""; } for (var x of infer_stmt()) { (x : string) } // error: number ~> string var infer_stmt_next = infer_stmt().next(0).value; // error: number ~> boolean -if (typeof infer_stmt_next === \"undefined\") { -} else if (typeof infer_stmt_next === \"number\") { +if (typeof infer_stmt_next === "undefined") { +} else if (typeof infer_stmt_next === "number") { } else { (infer_stmt_next : boolean) // error: string ~> boolean } function *widen_next() { var x = yield 0; - if (typeof x === \"number\") { - } else if (typeof x === \"boolean\") { + if (typeof x === "number") { + } else if (typeof x === "boolean") { } else { (x : string) // ok, sherlock } } widen_next().next(0) -widen_next().next(\"\") +widen_next().next("") widen_next().next(true) function *widen_yield() { yield 0; - yield \"\"; + yield ""; yield true; } for (var x of widen_yield()) { - if (typeof x === \"number\") { - } else if (typeof x === \"boolean\") { + if (typeof x === "number") { + } else if (typeof x === "boolean") { } else { (x : string) // ok, sherlock } @@ -381,11 +381,11 @@ function *delegate_next_generator() { } yield *inner(); } -delegate_next_generator().next(\"\"); +delegate_next_generator().next(""); function *delegate_yield_generator() { function *inner() { - yield \"\"; + yield ""; } yield *inner(); @@ -396,7 +396,7 @@ for (var x of delegate_yield_generator()) { function *delegate_return_generator() { function *inner() { - return \"\"; + return ""; } var x: number = yield *inner(); // error: string ~> number @@ -406,7 +406,7 @@ function *delegate_return_generator() { function *delegate_next_iterable(xs: Array) { yield *xs; } -delegate_next_iterable([]).next(\"\"); // error: Iterator has no next value +delegate_next_iterable([]).next(""); // error: Iterator has no next value function *delegate_yield_iterable(xs: Array) { yield *xs; @@ -435,7 +435,7 @@ function *multiple_return(b) { if (b) { return 0; } else { - return \"foo\"; + return "foo"; } } let multiple_return_result = multiple_return().next(); @@ -464,7 +464,7 @@ if (multiple_return_result.done) { // error: number|string ~> void function* stmt_yield(): Generator { yield 0; - yield \"\"; + yield ""; } function* stmt_next(): Generator { var a = yield; @@ -480,48 +480,48 @@ function* stmt_return_ok(): Generator { return 0; } function* stmt_return_err(): Generator { - return \"\"; + return ""; } function* infer_stmt() { var x: boolean = yield 0; - return \"\"; + return ""; } for (var x of infer_stmt()) { (x: string); } var infer_stmt_next = infer_stmt().next(0).value; -if (typeof infer_stmt_next === \"undefined\") { +if (typeof infer_stmt_next === "undefined") { } else - if (typeof infer_stmt_next === \"number\") { + if (typeof infer_stmt_next === "number") { } else { (infer_stmt_next: boolean); } function* widen_next() { var x = yield 0; - if (typeof x === \"number\") { + if (typeof x === "number") { } else - if (typeof x === \"boolean\") { + if (typeof x === "boolean") { } else { (x: string); } } widen_next().next(0); -widen_next().next(\"\"); +widen_next().next(""); widen_next().next(true); function* widen_yield() { yield 0; - yield \"\"; + yield ""; yield true; } for (var x of widen_yield()) { - if (typeof x === \"number\") { + if (typeof x === "number") { } else - if (typeof x === \"boolean\") { + if (typeof x === "boolean") { } else { (x: string); @@ -533,10 +533,10 @@ function* delegate_next_generator() { } yield* inner(); } -delegate_next_generator().next(\"\"); +delegate_next_generator().next(""); function* delegate_yield_generator() { function* inner() { - yield \"\"; + yield ""; } yield* inner(); } @@ -545,14 +545,14 @@ for (var x of delegate_yield_generator()) { } function* delegate_return_generator() { function* inner() { - return \"\"; + return ""; } var x: number = yield* inner(); } function* delegate_next_iterable(xs: Array) { yield* xs; } -delegate_next_iterable([ ]).next(\"\"); +delegate_next_iterable([ ]).next(""); function* delegate_yield_iterable(xs: Array) { yield* xs; } @@ -575,7 +575,7 @@ function* multiple_return(b) { if (b) { return 0; } else { - return \"foo\"; + return "foo"; } } let multiple_return_result = multiple_return().next(); @@ -587,13 +587,13 @@ if (multiple_return_result.done) { exports[`test return.js 1`] = ` "function test1(gen: Generator) { - // You can pass whatever you like to return, it doesn\'t need to be related to - // the Generator\'s return type + // You can pass whatever you like to return, it doesn't need to be related to + // the Generator's return type var ret = gen.return(0); (ret.value: void); // error: string | number ~> void } -// However, a generator can \"refuse\" the return by catching an exception and +// However, a generator can "refuse" the return by catching an exception and // yielding or returning internally. function *refuse_return() { try { @@ -603,15 +603,15 @@ function *refuse_return() { } } var refuse_return_gen = refuse_return(); -var refuse_return_result = refuse_return_gen.return(\"string\"); +var refuse_return_result = refuse_return_gen.return("string"); if (refuse_return_result.done) { (refuse_return_result.value: string); // error: number | void ~> string } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// You can pass whatever you like to return, it doesn\'t need to be related to -// the Generator\'s return type +// You can pass whatever you like to return, it doesn't need to be related to +// the Generator's return type // error: string | number ~> void -// However, a generator can \"refuse\" the return by catching an exception and +// However, a generator can "refuse" the return by catching an exception and // yielding or returning internally. // error: number | void ~> string function test1(gen: Generator) { @@ -626,7 +626,7 @@ function* refuse_return() { } } var refuse_return_gen = refuse_return(); -var refuse_return_result = refuse_return_gen.return(\"string\"); +var refuse_return_result = refuse_return_gen.return("string"); if (refuse_return_result.done) { (refuse_return_result.value: string); } @@ -642,7 +642,7 @@ exports[`test throw.js 1`] = ` } } -var catch_return_value = catch_return().throw(\"\").value; +var catch_return_value = catch_return().throw("").value; if (catch_return_value !== undefined) { (catch_return_value : string); // error: number ~> string } @@ -655,7 +655,7 @@ function *yield_return() { yield e; } } -var yield_return_value = yield_return().throw(\"\").value; +var yield_return_value = yield_return().throw("").value; if (yield_return_value !== undefined) { (yield_return_value: string); // error: number ~> string } @@ -669,7 +669,7 @@ function* catch_return() { return e; } } -var catch_return_value = catch_return().throw(\"\").value; +var catch_return_value = catch_return().throw("").value; if (catch_return_value !== undefined) { (catch_return_value: string); } @@ -681,7 +681,7 @@ function* yield_return() { yield e; } } -var yield_return_value = yield_return().throw(\"\").value; +var yield_return_value = yield_return().throw("").value; if (yield_return_value !== undefined) { (yield_return_value: string); } diff --git a/tests/generics/__snapshots__/jsfmt.spec.js.snap b/tests/generics/__snapshots__/jsfmt.spec.js.snap index d9d390101..28aaeeae2 100644 --- a/tests/generics/__snapshots__/jsfmt.spec.js.snap +++ b/tests/generics/__snapshots__/jsfmt.spec.js.snap @@ -36,12 +36,12 @@ class H extends G> { } var h1 = new H(); -h1.foo([\"...\"]); +h1.foo(["..."]); var h2:F>>> = h1; var obj : Object = {} // error, arity 0 -var fn : Function = function() { return \'foo\'; } // error, arity 0 -var fn : function = function() { return \'foo\'; } // error, arity 0 +var fn : Function = function() { return 'foo'; } // error, arity 0 +var fn : function = function() { return 'foo'; } // error, arity 0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //x:X; /*return x;*/ @@ -89,14 +89,14 @@ class H extends G> { } } var h1 = new H(); -h1.foo([ \"...\" ]); +h1.foo([ "..." ]); var h2: F>>> = h1; var obj: Object = {}; var fn: Function = function() { - return \"foo\"; + return "foo"; }; var fn: function = function() { - return \"foo\"; + return "foo"; }; " `; diff --git a/tests/get-def/__snapshots__/jsfmt.spec.js.snap b/tests/get-def/__snapshots__/jsfmt.spec.js.snap index 71a3899a6..62362d0ab 100644 --- a/tests/get-def/__snapshots__/jsfmt.spec.js.snap +++ b/tests/get-def/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test example.js 1`] = ` "/* @flow */ -var lib = require(\'./library\'); +var lib = require('./library'); function add(a: number, b: number): number { return a + b; @@ -18,7 +18,7 @@ lib.bar(); /* @flow */ // t123456 // D123456 -var lib = require(\"./library\"); +var lib = require("./library"); function add(a: number, b: number): number { return a + b; } @@ -31,23 +31,23 @@ lib.bar(); exports[`test imports.js 1`] = ` "// @flow -import thing from \"./helpers/exports_default.js\"; +import thing from "./helpers/exports_default.js"; thing; -import {foo, bar as baz} from \"./helpers/exports_named.js\"; +import {foo, bar as baz} from "./helpers/exports_named.js"; foo; baz; -import * as things from \"./helpers/exports_named.js\"; +import * as things from "./helpers/exports_named.js"; things; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import thing from \"./helpers/exports_default.js\"; +import thing from "./helpers/exports_default.js"; thing; -import { foo, bar as baz } from \"./helpers/exports_named.js\"; +import { foo, bar as baz } from "./helpers/exports_named.js"; foo; baz; -import * as things from \"./helpers/exports_named.js\"; +import * as things from "./helpers/exports_named.js"; things; " `; diff --git a/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap b/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap index 68905bef9..1b17c7e51 100644 --- a/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/get-def2/lib/__snapshots__/jsfmt.spec.js.snap @@ -11,8 +11,8 @@ type $JSXIntrinsics = { declare var $React: $Exports<"react">; type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { - div: $JSXIntrinsic<{ id: string }>, - span: $JSXIntrinsic<{ id: string, class: string }> + div: $JSXIntrinsic<{ id: string }>; + span: $JSXIntrinsic<{ id: string; class: string }> }; " `; diff --git a/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap b/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap index ca2c8ab55..e72641a71 100644 --- a/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap +++ b/tests/getters_and_setters_enabled/__snapshots__/jsfmt.spec.js.snap @@ -24,10 +24,10 @@ class Foo { get propWithSubtypingGetterAndSetterReordered(): ?number { return 4; } get propWithMismatchingGetterAndSetter(): number { return 4; } - set propWithMismatchingGetterAndSetter(x: string) { } // doesn\'t match getter (OK) + set propWithMismatchingGetterAndSetter(x: string) { } // doesn't match getter (OK) propOverriddenWithGetter: number; - get propOverriddenWithGetter() { return \"hello\"; } + get propOverriddenWithGetter() { return "hello"; } propOverriddenWithSetter: number; set propOverriddenWithSetter(x: string) { } @@ -47,8 +47,8 @@ foo.goodSetterNoAnnotation = 123; foo.goodSetterWithAnnotation = 123; // TODO: Why does no annotation mean no error? -foo.goodSetterNoAnnotation = \"hello\"; // Error string ~> number -foo.goodSetterWithAnnotation = \"hello\"; // Error string ~> number +foo.goodSetterNoAnnotation = "hello"; // Error string ~> number +foo.goodSetterWithAnnotation = "hello"; // Error string ~> number var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; // Error ?number ~> number @@ -60,7 +60,7 @@ foo.propOverriddenWithSetter = 123; // Error number ~> string */ // The getter and setter need not have the same type - no error // The getter and setter need not have the same type - no error -// doesn\'t match getter (OK) +// doesn't match getter (OK) // Test getting properties with getters // Error number ~> string // Error number ~> string @@ -111,7 +111,7 @@ class Foo { } propOverriddenWithGetter: number; get propOverriddenWithGetter() { - return \"hello\"; + return "hello"; } propOverriddenWithSetter: number; set propOverriddenWithSetter(x: string) { @@ -125,8 +125,8 @@ var testGetterWithError1: string = foo.goodGetterNoAnnotation; var testGetterWithError2: string = foo.goodGetterWithAnnotation; foo.goodSetterNoAnnotation = 123; foo.goodSetterWithAnnotation = 123; -foo.goodSetterNoAnnotation = \"hello\"; -foo.goodSetterWithAnnotation = \"hello\"; +foo.goodSetterNoAnnotation = "hello"; +foo.goodSetterWithAnnotation = "hello"; var testSubtypingGetterAndSetter: number = foo.propWithSubtypingGetterAndSetter; var testPropOverridenWithGetter: number = foo.propOverriddenWithGetter; foo.propOverriddenWithSetter = 123; @@ -181,17 +181,17 @@ var testGetterWithError2: string = obj.goodGetterWithAnnotation; // Error number obj.goodSetterNoAnnotation = 123; obj.goodSetterWithAnnotation = 123; -obj.goodSetterNoAnnotation = \"hello\"; // Error string ~> number -obj.goodSetterWithAnnotation = \"hello\"; // Error string ~> number +obj.goodSetterNoAnnotation = "hello"; // Error string ~> number +obj.goodSetterWithAnnotation = "hello"; // Error string ~> number var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; // Error ?number ~> number // When building this feature, it was tempting to flow the setter into the // getter and then use either the getter or setter as the type of the property. -// This example shows the danger of using the getter\'s type +// This example shows the danger of using the getter's type obj.exampleOfOrderOfGetterAndSetter = new C(); // Error C ~> B -// And this example shows the danger of using the setter\'s type. +// And this example shows the danger of using the setter's type. var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered; // Error A ~> B ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -210,9 +210,9 @@ var testExampleOrOrderOfGetterAndSetterReordered: number = // Error ?number ~> number // When building this feature, it was tempting to flow the setter into the // getter and then use either the getter or setter as the type of the property. -// This example shows the danger of using the getter\'s type +// This example shows the danger of using the getter's type // Error C ~> B -// And this example shows the danger of using the setter\'s type. +// And this example shows the danger of using the setter's type. // Error A ~> B var z: number = 123; class A {} @@ -268,8 +268,8 @@ var testGetterWithError1: string = obj.goodGetterNoAnnotation; var testGetterWithError2: string = obj.goodGetterWithAnnotation; obj.goodSetterNoAnnotation = 123; obj.goodSetterWithAnnotation = 123; -obj.goodSetterNoAnnotation = \"hello\"; -obj.goodSetterWithAnnotation = \"hello\"; +obj.goodSetterNoAnnotation = "hello"; +obj.goodSetterWithAnnotation = "hello"; var testSubtypingGetterAndSetter: number = obj.propWithSubtypingGetterAndSetter; obj.exampleOfOrderOfGetterAndSetter = new C(); var testExampleOrOrderOfGetterAndSetterReordered: number = obj.exampleOfOrderOfGetterAndSetterReordered; diff --git a/tests/import_type/__snapshots__/jsfmt.spec.js.snap b/tests/import_type/__snapshots__/jsfmt.spec.js.snap index ba4b20bf9..5f6919d35 100644 --- a/tests/import_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/import_type/__snapshots__/jsfmt.spec.js.snap @@ -115,7 +115,7 @@ export function givesAFoo3Obj(): AliasFoo3 { /** * @flow */ -export type AliasFoo3 = { givesANum: : () => number }; +export type AliasFoo3 = { givesANum(): number }; export function givesAFoo3Obj(): AliasFoo3 { return { givesANum(): number { @@ -170,8 +170,8 @@ exports[`test import_type.js 1`] = ` // == Importing Class Type (Default Export) == // ///////////////////////////////////////////////// -import type ClassFoo1 from \"./ExportDefault_Class\"; -import {foo1Inst} from \"./ExportDefault_Class\"; +import type ClassFoo1 from "./ExportDefault_Class"; +import {foo1Inst} from "./ExportDefault_Class"; var a1: ClassFoo1 = foo1Inst; var a2: number = foo1Inst; // Error: ClassFoo1 ~> number @@ -181,8 +181,8 @@ new ClassFoo1(); // Error: ClassFoo1 is not a value-identifier // == Importing Class Type (Named Export) == // /////////////////////////////////////////////// -import type {ClassFoo2} from \"./ExportNamed_Class\"; -import {foo2Inst} from \"./ExportNamed_Class\"; +import type {ClassFoo2} from "./ExportNamed_Class"; +import {foo2Inst} from "./ExportNamed_Class"; var b1: ClassFoo2 = foo2Inst; var b2: number = foo2Inst; // Error: ClassFoo2 ~> number @@ -192,8 +192,8 @@ new ClassFoo2(); // Error: ClassFoo2 is not a value-identifier // == Importing Class Type (CJS Default Export) == // ///////////////////////////////////////////////////// -import type ClassFoo3T from \"./ExportCJSDefault_Class\"; -import ClassFoo3 from \"./ExportCJSDefault_Class\"; +import type ClassFoo3T from "./ExportCJSDefault_Class"; +import ClassFoo3 from "./ExportCJSDefault_Class"; var c1: ClassFoo3T = new ClassFoo3(); new ClassFoo3T(); // Error: ClassFoo3 is not a value-identifier @@ -201,38 +201,38 @@ new ClassFoo3T(); // Error: ClassFoo3 is not a value-identifier // == Importing Class Type (CJS Named Export) == // /////////////////////////////////////////////////// -import type {ClassFoo4, ClassFoo5} from \"./ExportCJSNamed_Class\"; -import {foo4Inst, foo5Inst} from \"./ExportCJSNamed_Class\"; +import type {ClassFoo4, ClassFoo5} from "./ExportCJSNamed_Class"; +import {foo4Inst, foo5Inst} from "./ExportCJSNamed_Class"; var d1: ClassFoo4 = foo4Inst; var d2: number = foo4Inst; // Error: ClassFoo4 ~> number new ClassFoo4(); // Error: ClassFoo4 is not a value-identifier -// TODO: this errors correctly, but the message is just \'can\'t resolve name\' -var d3: typeof ClassFoo5 = foo5Inst; // Error: Can\'t typeof a type alias +// TODO: this errors correctly, but the message is just 'can't resolve name' +var d3: typeof ClassFoo5 = foo5Inst; // Error: Can't typeof a type alias //////////////////////////////////////////// // == Import Type Alias (Named Export) == // //////////////////////////////////////////// -import type {AliasFoo3} from \"./ExportNamed_Alias\"; -import {givesAFoo3Obj} from \"./ExportNamed_Alias\"; +import type {AliasFoo3} from "./ExportNamed_Alias"; +import {givesAFoo3Obj} from "./ExportNamed_Alias"; var e1: AliasFoo3 = givesAFoo3Obj(); var e2: number = givesAFoo3Obj(); // Error: AliasFoo3 ~> number -var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can\'t typeof a type alias +var e3: typeof AliasFoo3 = givesAFoo3Obj(); // Error: Can't typeof a type alias ////////////////////////////////////////////// // == Import Type Alias (Default Export) == // ////////////////////////////////////////////// -// TODO: No support for this right now. It\'s most likely possible, but it\'s +// TODO: No support for this right now. It's most likely possible, but it's // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I\'m punting on it for now. +// more work than named type exports, so I'm punting on it for now. /////////////////////////////////////////////////////// // == Import Type With Non-Alias Compatible Value == // /////////////////////////////////////////////////////// -import type {numValue} from \"./ExportsANumber\"; // Error: Cannot import-type a number value +import type {numValue} from "./ExportsANumber"; // Error: Cannot import-type a number value //////////////////////////////////////////////////////////////////////// // == Regression Test: https://github.com/facebook/flow/issues/359 == // @@ -240,7 +240,7 @@ import type {numValue} from \"./ExportsANumber\"; // Error: Cannot import-type a // env contexts. // //////////////////////////////////////////////////////////////////////// -import type ClassFoo6 from \"./issue-359\"; +import type ClassFoo6 from "./issue-359"; function foo() { ClassFoo6; // Error: Not a value binding } @@ -267,19 +267,19 @@ function foo() { /////////////////////////////////////////////////// // Error: ClassFoo4 ~> number // Error: ClassFoo4 is not a value-identifier -// TODO: this errors correctly, but the message is just \'can\'t resolve name\' -// Error: Can\'t typeof a type alias +// TODO: this errors correctly, but the message is just 'can't resolve name' +// Error: Can't typeof a type alias //////////////////////////////////////////// // == Import Type Alias (Named Export) == // //////////////////////////////////////////// // Error: AliasFoo3 ~> number -// Error: Can\'t typeof a type alias +// Error: Can't typeof a type alias ////////////////////////////////////////////// // == Import Type Alias (Default Export) == // ////////////////////////////////////////////// -// TODO: No support for this right now. It\'s most likely possible, but it\'s +// TODO: No support for this right now. It's most likely possible, but it's // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I\'m punting on it for now. +// more work than named type exports, so I'm punting on it for now. /////////////////////////////////////////////////////// // == Import Type With Non-Alias Compatible Value == // /////////////////////////////////////////////////////// @@ -290,33 +290,33 @@ function foo() { // env contexts. // //////////////////////////////////////////////////////////////////////// // Error: Not a value binding -import type ClassFoo1 from \"./ExportDefault_Class\"; -import { foo1Inst } from \"./ExportDefault_Class\"; +import type ClassFoo1 from "./ExportDefault_Class"; +import { foo1Inst } from "./ExportDefault_Class"; var a1: ClassFoo1 = foo1Inst; var a2: number = foo1Inst; new ClassFoo1(); -import type { ClassFoo2 } from \"./ExportNamed_Class\"; -import { foo2Inst } from \"./ExportNamed_Class\"; +import type { ClassFoo2 } from "./ExportNamed_Class"; +import { foo2Inst } from "./ExportNamed_Class"; var b1: ClassFoo2 = foo2Inst; var b2: number = foo2Inst; new ClassFoo2(); -import type ClassFoo3T from \"./ExportCJSDefault_Class\"; -import ClassFoo3 from \"./ExportCJSDefault_Class\"; +import type ClassFoo3T from "./ExportCJSDefault_Class"; +import ClassFoo3 from "./ExportCJSDefault_Class"; var c1: ClassFoo3T = new ClassFoo3(); new ClassFoo3T(); -import type { ClassFoo4, ClassFoo5 } from \"./ExportCJSNamed_Class\"; -import { foo4Inst, foo5Inst } from \"./ExportCJSNamed_Class\"; +import type { ClassFoo4, ClassFoo5 } from "./ExportCJSNamed_Class"; +import { foo4Inst, foo5Inst } from "./ExportCJSNamed_Class"; var d1: ClassFoo4 = foo4Inst; var d2: number = foo4Inst; new ClassFoo4(); var d3: typeof ClassFoo5 = foo5Inst; -import type { AliasFoo3 } from \"./ExportNamed_Alias\"; -import { givesAFoo3Obj } from \"./ExportNamed_Alias\"; +import type { AliasFoo3 } from "./ExportNamed_Alias"; +import { givesAFoo3Obj } from "./ExportNamed_Alias"; var e1: AliasFoo3 = givesAFoo3Obj(); var e2: number = givesAFoo3Obj(); var e3: typeof AliasFoo3 = givesAFoo3Obj(); -import type { numValue } from \"./ExportsANumber\"; -import type ClassFoo6 from \"./issue-359\"; +import type { numValue } from "./ExportsANumber"; +import type ClassFoo6 from "./issue-359"; function foo() { ClassFoo6; } diff --git a/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap b/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap index f38cbf235..3657997b3 100644 --- a/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/import_typeof/__snapshots__/jsfmt.spec.js.snap @@ -114,7 +114,7 @@ export function givesAFoo3Obj(): AliasFoo3 { /** * @flow */ -export type AliasFoo3 = { givesANum: : () => number }; +export type AliasFoo3 = { givesANum(): number }; export function givesAFoo3Obj(): AliasFoo3 { return { givesANum(): number { @@ -152,11 +152,11 @@ exports[`test ExportNamed_Multi.js 1`] = ` "// @flow export var num = 42; -export var str = \'asdf\'; +export var str = 'asdf'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow export var num = 42; -export var str = \"asdf\"; +export var str = "asdf"; " `; @@ -179,8 +179,8 @@ exports[`test import_typeof.js 1`] = ` // == Importing Class Typeof (Default Export) == // /////////////////////////////////////////////////// -import typeof ClassFoo1T from \"./ExportDefault_Class\"; -import ClassFoo1 from \"./ExportDefault_Class\"; +import typeof ClassFoo1T from "./ExportDefault_Class"; +import ClassFoo1 from "./ExportDefault_Class"; var a1: ClassFoo1T = ClassFoo1; var a2: ClassFoo1T = new ClassFoo1(); // Error: ClassFoo1 (inst) ~> ClassFoo1 (class) @@ -190,8 +190,8 @@ new ClassFoo1T(); // Error: ClassFoo1T is not bound to a value // == Importing Class Typeof (Named Export) == // ///////////////////////////////////////////////// -import typeof {ClassFoo2 as ClassFoo2T} from \"./ExportNamed_Class\"; -import {ClassFoo2} from \"./ExportNamed_Class\"; +import typeof {ClassFoo2 as ClassFoo2T} from "./ExportNamed_Class"; +import {ClassFoo2} from "./ExportNamed_Class"; var b1: ClassFoo2T = ClassFoo2; var b2: ClassFoo2T = new ClassFoo2(); // Error: ClassFoo2 (inst) ~> ClassFoo2 (class) @@ -201,8 +201,8 @@ new ClassFoo2T(); // Error: ClassFoo2T is not bound to a value // == Importing Class Typeof (CJS Default Export) == // /////////////////////////////////////////////////////// -import typeof ClassFoo3T from \"./ExportCJSDefault_Class\"; -import ClassFoo3 from \"./ExportCJSDefault_Class\"; +import typeof ClassFoo3T from "./ExportCJSDefault_Class"; +import ClassFoo3 from "./ExportCJSDefault_Class"; var c1: ClassFoo3T = ClassFoo3; var c2: ClassFoo3T = new ClassFoo3(); // Error: ClassFoo3 (inst) ~> ClassFoo3 (class) @@ -211,8 +211,8 @@ var c2: ClassFoo3T = new ClassFoo3(); // Error: ClassFoo3 (inst) ~> ClassFoo3 (c // == Importing Class Typeof (CJS Named Export) == // ///////////////////////////////////////////////////// -import typeof {ClassFoo4 as ClassFoo4T} from \"./ExportCJSNamed_Class\"; -import {ClassFoo4} from \"./ExportCJSNamed_Class\"; +import typeof {ClassFoo4 as ClassFoo4T} from "./ExportCJSNamed_Class"; +import {ClassFoo4} from "./ExportCJSNamed_Class"; var d1: ClassFoo4T = ClassFoo4; var d2: ClassFoo4T = new ClassFoo4(); // Error: ClassFoo4 (inst) ~> ClassFoo4 (class) @@ -221,58 +221,58 @@ var d2: ClassFoo4T = new ClassFoo4(); // Error: ClassFoo4 (inst) ~> ClassFoo4 (c // == Import Typeof Alias (Named Export) == // ////////////////////////////////////////////// -import typeof {AliasFoo3} from \"./ExportNamed_Alias\"; // Error: Can\'t \`import typeof\` type aliases! +import typeof {AliasFoo3} from "./ExportNamed_Alias"; // Error: Can't \`import typeof\` type aliases! //////////////////////////////////////////////// // == Import Typeof Alias (Default Export) == // //////////////////////////////////////////////// -// TODO: No support for this right now. It\'s most likely possible, but it\'s +// TODO: No support for this right now. It's most likely possible, but it's // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I\'m punting on it for now. +// more work than named type exports, so I'm punting on it for now. /////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (Default Export) == // /////////////////////////////////////////////////////////////// -import typeof num_default from \"./ExportDefault_Number\"; +import typeof num_default from "./ExportDefault_Number"; var f1: num_default = 42; -var f2: num_default = \'asdf\'; // Error: string ~> number +var f2: num_default = 'asdf'; // Error: string ~> number ///////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (Named Export) == // ///////////////////////////////////////////////////////////// -import typeof {num as num_named} from \"./ExportNamed_Number\"; +import typeof {num as num_named} from "./ExportNamed_Number"; var g1: num_named = 42; -var g2: num_named = \'asdf\'; // Error: string ~> number +var g2: num_named = 'asdf'; // Error: string ~> number /////////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (CJS Default Export) == // /////////////////////////////////////////////////////////////////// -import typeof num_cjs_default from \"./ExportCJSDefault_Number\"; +import typeof num_cjs_default from "./ExportCJSDefault_Number"; var h1: num_cjs_default = 42; -var h2: num_cjs_default = \'asdf\'; // Error: string ~> number +var h2: num_cjs_default = 'asdf'; // Error: string ~> number ///////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (CJS Named Export) == // ///////////////////////////////////////////////////////////////// -import typeof {num as num_cjs_named} from \"./ExportCJSNamed_Number\"; +import typeof {num as num_cjs_named} from "./ExportCJSNamed_Number"; var i1: num_cjs_named = 42; -var i2: num_cjs_named = \'asdf\'; // Error: string ~> number +var i2: num_cjs_named = 'asdf'; // Error: string ~> number /////////////////////////////////////////////// // == Import Typeof ModuleNamespaceObject == // /////////////////////////////////////////////// -import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\"; -var j1: ModuleNSObjT = {num: 42, str: \'asdf\'}; +import typeof * as ModuleNSObjT from "./ExportNamed_Multi"; +var j1: ModuleNSObjT = {num: 42, str: 'asdf'}; var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -299,13 +299,13 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string ////////////////////////////////////////////// // == Import Typeof Alias (Named Export) == // ////////////////////////////////////////////// -// Error: Can\'t \`import typeof\` type aliases! +// Error: Can't \`import typeof\` type aliases! //////////////////////////////////////////////// // == Import Typeof Alias (Default Export) == // //////////////////////////////////////////////// -// TODO: No support for this right now. It\'s most likely possible, but it\'s +// TODO: No support for this right now. It's most likely possible, but it's // unclear how useful it is at the moment and it entails a little -// more work than named type exports, so I\'m punting on it for now. +// more work than named type exports, so I'm punting on it for now. /////////////////////////////////////////////////////////////// // == Import Typeof With Non-Class Value (Default Export) == // /////////////////////////////////////////////////////////////// @@ -326,39 +326,39 @@ var j2: ModuleNSObjT = {num: 42, str: 42}; // Error: number ~> string // == Import Typeof ModuleNamespaceObject == // /////////////////////////////////////////////// // Error: number ~> string -import typeof ClassFoo1T from \"./ExportDefault_Class\"; -import ClassFoo1 from \"./ExportDefault_Class\"; +import typeof ClassFoo1T from "./ExportDefault_Class"; +import ClassFoo1 from "./ExportDefault_Class"; var a1: ClassFoo1T = ClassFoo1; var a2: ClassFoo1T = new ClassFoo1(); new ClassFoo1T(); -import typeof { ClassFoo2 as ClassFoo2T } from \"./ExportNamed_Class\"; -import { ClassFoo2 } from \"./ExportNamed_Class\"; +import typeof { ClassFoo2 as ClassFoo2T } from "./ExportNamed_Class"; +import { ClassFoo2 } from "./ExportNamed_Class"; var b1: ClassFoo2T = ClassFoo2; var b2: ClassFoo2T = new ClassFoo2(); new ClassFoo2T(); -import typeof ClassFoo3T from \"./ExportCJSDefault_Class\"; -import ClassFoo3 from \"./ExportCJSDefault_Class\"; +import typeof ClassFoo3T from "./ExportCJSDefault_Class"; +import ClassFoo3 from "./ExportCJSDefault_Class"; var c1: ClassFoo3T = ClassFoo3; var c2: ClassFoo3T = new ClassFoo3(); -import typeof { ClassFoo4 as ClassFoo4T } from \"./ExportCJSNamed_Class\"; -import { ClassFoo4 } from \"./ExportCJSNamed_Class\"; +import typeof { ClassFoo4 as ClassFoo4T } from "./ExportCJSNamed_Class"; +import { ClassFoo4 } from "./ExportCJSNamed_Class"; var d1: ClassFoo4T = ClassFoo4; var d2: ClassFoo4T = new ClassFoo4(); -import typeof { AliasFoo3 } from \"./ExportNamed_Alias\"; -import typeof num_default from \"./ExportDefault_Number\"; +import typeof { AliasFoo3 } from "./ExportNamed_Alias"; +import typeof num_default from "./ExportDefault_Number"; var f1: num_default = 42; -var f2: num_default = \"asdf\"; -import typeof { num as num_named } from \"./ExportNamed_Number\"; +var f2: num_default = "asdf"; +import typeof { num as num_named } from "./ExportNamed_Number"; var g1: num_named = 42; -var g2: num_named = \"asdf\"; -import typeof num_cjs_default from \"./ExportCJSDefault_Number\"; +var g2: num_named = "asdf"; +import typeof num_cjs_default from "./ExportCJSDefault_Number"; var h1: num_cjs_default = 42; -var h2: num_cjs_default = \"asdf\"; -import typeof { num as num_cjs_named } from \"./ExportCJSNamed_Number\"; +var h2: num_cjs_default = "asdf"; +import typeof { num as num_cjs_named } from "./ExportCJSNamed_Number"; var i1: num_cjs_named = 42; -var i2: num_cjs_named = \"asdf\"; -import typeof * as ModuleNSObjT from \"./ExportNamed_Multi\"; -var j1: ModuleNSObjT = { num: 42, str: \"asdf\" }; +var i2: num_cjs_named = "asdf"; +import typeof * as ModuleNSObjT from "./ExportNamed_Multi"; +var j1: ModuleNSObjT = { num: 42, str: "asdf" }; var j2: ModuleNSObjT = { num: 42, str: 42 }; " `; diff --git a/tests/incremental/__snapshots__/jsfmt.spec.js.snap b/tests/incremental/__snapshots__/jsfmt.spec.js.snap index 096c7563c..f9f62a407 100644 --- a/tests/incremental/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental/__snapshots__/jsfmt.spec.js.snap @@ -11,12 +11,12 @@ exports[`test b.js 1`] = ` @flow */ -var A = require(\'IncrModuleA\'); +var A = require('IncrModuleA'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule IncrModuleB @flow */ -var A = require(\"IncrModuleA\"); +var A = require("IncrModuleA"); " `; diff --git a/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap index a0eb1b11d..6e2e14263 100644 --- a/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_basic/__snapshots__/jsfmt.spec.js.snap @@ -11,12 +11,12 @@ module.exports = a; exports[`test b.js 1`] = ` "// @flow -var a = require(\'./a\'); +var a = require('./a'); var b: number = a; module.exports = b; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var a = require(\"./a\"); +var a = require("./a"); var b: number = a; module.exports = b; " @@ -24,12 +24,12 @@ module.exports = b; exports[`test c.js 1`] = ` "// @flow -var b = require(\'./b\'); +var b = require('./b'); var c: string = b; module.exports = c; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var b = require(\"./b\"); +var b = require("./b"); var c: string = b; module.exports = c; " diff --git a/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap b/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap index 850937310..36644249d 100644 --- a/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap +++ b/tests/incremental_delete/__snapshots__/jsfmt.spec.js.snap @@ -11,12 +11,12 @@ module.exports = a; exports[`test b.js 1`] = ` "// @flow -var a = require(\'./a\'); +var a = require('./a'); var b: number = a; module.exports = b; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var a = require(\"./a\"); +var a = require("./a"); var b: number = a; module.exports = b; " @@ -24,12 +24,12 @@ module.exports = b; exports[`test c.js 1`] = ` "// @flow -var b = require(\'./b\'); +var b = require('./b'); var c: string = b; module.exports = c; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var b = require(\"./b\"); +var b = require("./b"); var c: string = b; module.exports = c; " @@ -41,14 +41,14 @@ exports[`test dupe1.js 1`] = ` * @providesModule Dupe * @flow */ -module.exports = \"dupe1\"; +module.exports = "dupe1"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 1/2 * @providesModule Dupe * @flow */ -module.exports = \"dupe1\"; +module.exports = "dupe1"; " `; @@ -58,14 +58,14 @@ exports[`test dupe2.js 1`] = ` * @providesModule Dupe * @flow */ -module.exports = \"dupe2\"; +module.exports = "dupe2"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Dupe provider 2/2 * @providesModule Dupe * @flow */ -module.exports = \"dupe2\"; +module.exports = "dupe2"; " `; @@ -74,13 +74,13 @@ exports[`test requires_dupe.js 1`] = ` * depends on doubly-provided module * @flow */ -var dupe = require(\'Dupe\'); +var dupe = require('Dupe'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * depends on doubly-provided module * @flow */ -var dupe = require(\"Dupe\"); +var dupe = require("Dupe"); " `; @@ -89,13 +89,13 @@ exports[`test requires_unchecked.js 1`] = ` * depends on an unchecked module, which will be deleted * @flow */ -var unchecked = require(\'Unchecked\'); +var unchecked = require('Unchecked'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * depends on an unchecked module, which will be deleted * @flow */ -var unchecked = require(\"Unchecked\"); +var unchecked = require("Unchecked"); " `; @@ -104,12 +104,12 @@ exports[`test unchecked.js 1`] = ` * Not a flow module. * @providesModule Unchecked */ -module.exports = \"unchecked\"; +module.exports = "unchecked"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Not a flow module. * @providesModule Unchecked */ -module.exports = \"unchecked\"; +module.exports = "unchecked"; " `; diff --git a/tests/indexer/__snapshots__/jsfmt.spec.js.snap b/tests/indexer/__snapshots__/jsfmt.spec.js.snap index 7034e3a7c..bd9a2ea07 100644 --- a/tests/indexer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/indexer/__snapshots__/jsfmt.spec.js.snap @@ -62,13 +62,13 @@ function foo3(): { [key: string]: number } { function foo4(): { [key: number]: number } { return { foo: "bar" }; } -function foo5(): { [key: string]: number, foo: string } { +function foo5(): { [key: string]: number; foo: string } { return { foo: "bar" }; } -function foo6(): { [key: number]: number, foo: string } { +function foo6(): { [key: number]: number; foo: string } { return { foo: "bar" }; } -function foo7(): { [key: string]: number, foo: number } { +function foo7(): { [key: string]: number; foo: number } { return { foo: "bar" }; } " @@ -90,7 +90,7 @@ let tests = [ /* error: not supported (yet)*/ let tests = [ function() { - ({}: { [k1: string]: string, [k2: number]: number }); + ({}: { [k1: string]: string; [k2: number]: number }); } ]; " diff --git a/tests/instanceof/__snapshots__/jsfmt.spec.js.snap b/tests/instanceof/__snapshots__/jsfmt.spec.js.snap index f17c7de02..91c2dc617 100644 --- a/tests/instanceof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/instanceof/__snapshots__/jsfmt.spec.js.snap @@ -9,13 +9,13 @@ function x(b) { return b ? new X1 : new X2; } function consumer1(b) { var g = x(b); - if (g instanceof X2) g.foo = \'1337\'; + if (g instanceof X2) g.foo = '1337'; else g.foo = 1337; } function consumer2(b) { var g = x(b); - if (g instanceof X1) g.foo = \'1337\'; // oops + if (g instanceof X1) g.foo = '1337'; // oops } // x.y instanceof t @@ -26,13 +26,13 @@ function y(b) { return b ? new Y1 : new Y2; } function consumer3(b) { var g = y(b); - if (g.bar instanceof X2) g.bar.foo = \'1337\'; + if (g.bar instanceof X2) g.bar.foo = '1337'; else g.bar.foo = 1337; } function consumer4(b) { var g = y(b); - if (g.bar instanceof X1) g.bar.foo = \'1337\'; // oops + if (g.bar instanceof X1) g.bar.foo = '1337'; // oops } // x.y.z instance of t @@ -43,13 +43,13 @@ function z(b) { return b ? new Z1 : new Z2; } function consumer5(b) { var g = z(b); - if (g.baz.bar instanceof X2) g.baz.bar.foo = \'1337\'; + if (g.baz.bar instanceof X2) g.baz.bar.foo = '1337'; else g.baz.bar.foo = 1337; } function consumer6(b) { var g = z(b); - if (g.baz.bar instanceof X1) g.baz.bar.foo = \'1337\'; // oops + if (g.baz.bar instanceof X1) g.baz.bar.foo = '1337'; // oops } // this instanceof t @@ -58,7 +58,7 @@ class C { if (this instanceof D) alert(this.s); else - alert(\"nope\"); + alert("nope"); } } @@ -66,7 +66,7 @@ class D extends C { s: string; constructor() { super(); - this.s = \"yup\"; + this.s = "yup"; } } @@ -109,14 +109,14 @@ function x(b) { function consumer1(b) { var g = x(b); if (g instanceof X2) - g.foo = \"1337\"; + g.foo = "1337"; else g.foo = 1337; } function consumer2(b) { var g = x(b); if (g instanceof X1) - g.foo = \"1337\"; + g.foo = "1337"; } class Y1 { bar: X1; @@ -130,14 +130,14 @@ function y(b) { function consumer3(b) { var g = y(b); if (g.bar instanceof X2) - g.bar.foo = \"1337\"; + g.bar.foo = "1337"; else g.bar.foo = 1337; } function consumer4(b) { var g = y(b); if (g.bar instanceof X1) - g.bar.foo = \"1337\"; + g.bar.foo = "1337"; } class Z1 { baz: Y1; @@ -151,28 +151,28 @@ function z(b) { function consumer5(b) { var g = z(b); if (g.baz.bar instanceof X2) - g.baz.bar.foo = \"1337\"; + g.baz.bar.foo = "1337"; else g.baz.bar.foo = 1337; } function consumer6(b) { var g = z(b); if (g.baz.bar instanceof X1) - g.baz.bar.foo = \"1337\"; + g.baz.bar.foo = "1337"; } class C { m() { if (this instanceof D) alert(this.s); else - alert(\"nope\"); + alert("nope"); } } class D extends C { s: string; constructor() { super(); - this.s = \"yup\"; + this.s = "yup"; } } function foo0(x: Array | number) { diff --git a/tests/interface/__snapshots__/jsfmt.spec.js.snap b/tests/interface/__snapshots__/jsfmt.spec.js.snap index 633aba7ac..67a97b232 100644 --- a/tests/interface/__snapshots__/jsfmt.spec.js.snap +++ b/tests/interface/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test import.js 1`] = ` export type J = I; // workaround for export interface ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // workaround for export interface -interface I extends { x: number } +interface I { x: number } export type J = I; " `; @@ -22,8 +22,8 @@ interface Bad { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow /* error: not supported (yet)*/ -interface Ok extends { [key: string]: string } -interface Bad extends { [k1: string]: string, [k2: number]: number } +interface Ok { [key: string]: string } +interface Bad { [k1: string]: string; [k2: number]: number } " `; @@ -46,7 +46,7 @@ function testInterfaceName(o: I) { // ok declare class C { x: number } var x: string = new C().x; -interface I extends { x: number } +interface I { x: number } var i = new I(); function testInterfaceName(o: I) { (o.name: string); @@ -86,17 +86,17 @@ var e: E = { x: \"\", y: \"\", z: \"\" }; // error: x and z should be nu // error: x and z should be numbers // error: x is number // error: z is number -interface I extends { y: string } -interface I_ extends { x: number } +interface I { y: string } +interface I_ { x: number } interface J extends I, I_ {} interface K extends J {} var k: K = { x: \"\", y: \"\" }; (k.x: string); (k.y: string); declare class C { x: number } -declare class D {} -interface A extends { y: Y } -interface A_ extends { x: X } +declare class D extends C, Other {} +interface A { y: Y } +interface A_ { x: X } interface B extends A, A_ { z: Z } interface E extends B {} var e: E = { x: \"\", y: \"\", z: \"\" }; @@ -122,7 +122,7 @@ function bar(m: M) { m.x; m.y; m.z; } // OK // interface + multiple inheritance is similar to object type + intersection // OK import type { J } from \"./import\"; -interface K extends {} +interface K {} interface L extends J, K { y: string } function foo(l: L) { l.x; @@ -150,8 +150,8 @@ function foo(k: K) { // error: x is number in I // error: x is string in K // error: y is string in I -interface I extends { x: number, y: string } -interface J extends { y: number } +interface I { x: number; y: string } +interface J { y: number } interface K extends I, J { x: string } function foo(k: K) { (k.x: number); @@ -173,14 +173,11 @@ new C().bar((x: string) => { }); // error, number ~/~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error, property \`foo\` not found function // error, number ~/~> string -interface I extends { foo: : (x: number) => void } +interface I { foo(x: number): void } (function foo(x: number) { }: I); -declare class C { - bar: : (i: I) => void, - bar: : (f: (x: number) => void) => void -} +declare class C { bar(i: I): void; bar(f: (x: number) => void): void } new C().bar( (x: string) => { diff --git a/tests/intersection/__snapshots__/jsfmt.spec.js.snap b/tests/intersection/__snapshots__/jsfmt.spec.js.snap index dd2102324..917a0deb6 100644 --- a/tests/intersection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/intersection/__snapshots__/jsfmt.spec.js.snap @@ -76,8 +76,8 @@ function hasObjectMode_ok(options: DuplexStreamOptions): boolean { */ // error, undefined ~> boolean type DuplexStreamOptions = ReadableStreamOptions & WritableStreamOptions & { - allowHalfOpen?: boolean, - readableObjectMode?: boolean, + allowHalfOpen?: boolean; + readableObjectMode?: boolean; writableObjectMode?: boolean }; function hasObjectMode_bad(options: DuplexStreamOptions): boolean { @@ -141,13 +141,13 @@ var g: (_: number | string) => void = f; */ // intersection of function types satisfies union of param types // simpler variation -type F = : (_: ObjA) => void; -type G = : (_: ObjB) => void; -type FG = : (_: ObjA | ObjB) => void; +type F = (_: ObjA) => void; +type G = (_: ObjB) => void; +type FG = (_: ObjA | ObjB) => void; declare var fun1: F & G; (fun1: FG); var fun2: FG = fun1; -declare var f: : (_: number) => void & : (_: string) => void; +declare var f: (_: number) => void & (_: string) => void; var g: (_: number | string) => void = f; " `; diff --git a/tests/intersection/lib/__snapshots__/jsfmt.spec.js.snap b/tests/intersection/lib/__snapshots__/jsfmt.spec.js.snap index 3925636be..5589c7870 100644 --- a/tests/intersection/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/intersection/lib/__snapshots__/jsfmt.spec.js.snap @@ -46,19 +46,19 @@ type D = { [key: string]: number }; // type ObjAssignT = { foo: string } & { bar: string }; type ReadableStreamOptions = { - highWaterMark?: number, - encoding?: ?string, + highWaterMark?: number; + encoding?: ?string; objectMode?: boolean }; type WritableStreamOptions = { - highWaterMark?: number, - decodeString?: boolean, + highWaterMark?: number; + decodeString?: boolean; objectMode?: boolean }; -type ObjA = { foo: number, bar: string }; +type ObjA = { foo: number; bar: string }; type ObjB = { baz: boolean }; type A = { a: string } & { b: string }; -type B = { a: string, b: string }; +type B = { a: string; b: string }; type C = { [key: string]: number } & { [key: string]: number }; type D = { [key: string]: number }; " diff --git a/tests/issues-11/__snapshots__/jsfmt.spec.js.snap b/tests/issues-11/__snapshots__/jsfmt.spec.js.snap index 31d0b8f39..df05715b9 100644 --- a/tests/issues-11/__snapshots__/jsfmt.spec.js.snap +++ b/tests/issues-11/__snapshots__/jsfmt.spec.js.snap @@ -1,22 +1,22 @@ exports[`test export.js 1`] = ` "/* @flow */ exports.x = 1; -exports.y = \"\"; +exports.y = ""; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ exports.x = 1; -exports.y = \"\"; +exports.y = ""; " `; exports[`test import.js 1`] = ` "/* @flow */ -var e = require(\'./export\'); +var e = require('./export'); var x: string = e.x; var y: number = e.y; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var e = require(\"./export\"); +var e = require("./export"); var x: string = e.x; var y: number = e.y; " diff --git a/tests/iter/__snapshots__/jsfmt.spec.js.snap b/tests/iter/__snapshots__/jsfmt.spec.js.snap index 8d040ac19..4adfe042e 100644 --- a/tests/iter/__snapshots__/jsfmt.spec.js.snap +++ b/tests/iter/__snapshots__/jsfmt.spec.js.snap @@ -6,7 +6,7 @@ for (var i=0;i<3;i++) { foo(a[i]); } for (var k in a) { - foo(a[k]); // k is a string, which shouldn\'t be used for array access + foo(a[k]); // k is a string, which shouldn't be used for array access } var b = (null : ?{[key: string]: string}); @@ -21,7 +21,7 @@ for (var m in (c = b)) { var d; for (var n in (d = a)) { - foo(d[n]); // d is a string, which shouldn\'t be used for array access + foo(d[n]); // d is a string, which shouldn't be used for array access } for (var x in undefined) { @@ -33,16 +33,16 @@ for (var x in null) { } for (var y in this) { - // regression test to make sure \`in this\` doesn\'t fatal. it\'s currently - // allowed, even though we can\'t actually enumerate all the keys on \`this\`. + // regression test to make sure \`in this\` doesn't fatal. it's currently + // allowed, even though we can't actually enumerate all the keys on \`this\`. } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// k is a string, which shouldn\'t be used for array access -// d is a string, which shouldn\'t be used for array access +// k is a string, which shouldn't be used for array access +// d is a string, which shouldn't be used for array access // unreachable // unreachable -// regression test to make sure \`in this\` doesn\'t fatal. it\'s currently -// allowed, even though we can\'t actually enumerate all the keys on \`this\`. +// regression test to make sure \`in this\` doesn't fatal. it's currently +// allowed, even though we can't actually enumerate all the keys on \`this\`. var a = [ true, false ]; function foo(x) { diff --git a/tests/iterable/__snapshots__/jsfmt.spec.js.snap b/tests/iterable/__snapshots__/jsfmt.spec.js.snap index 7340dcf54..a58f2d160 100644 --- a/tests/iterable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/iterable/__snapshots__/jsfmt.spec.js.snap @@ -180,10 +180,10 @@ function mapTest4(map: Map): Iterable { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error - Map is an Iterable<[K, V]> -function mapTest1(map: Map): Iterable<[stringnumber]> { +function mapTest1(map: Map): Iterable<[string, number]> { return map; } -function mapTest2(map: Map): Iterable<[KV]> { +function mapTest2(map: Map): Iterable<[K, V]> { return map; } function mapTest3(map: Map): Iterable<*> { diff --git a/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap index 654f05bb9..b2519930c 100644 --- a/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_intrinsics.builtin/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test main.js 1`] = ` "// @flow -var React = require(\'react\'); +var React = require('react'); class CustomComponent extends React.Component { props: { @@ -9,56 +9,56 @@ class CustomComponent extends React.Component { }; } -var a: React.Element<{prop: string}> = ; -var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> +var a: React.Element<{prop: string}> = ; +var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> // Since intrinsics are typed as \`any\` out of the box, we can pass any // attributes to intrinsics! -var c: React.Element =
; -// However, we don\'t allow such elements to be viewed as React elements with +var c: React.Element =
; +// However, we don't allow such elements to be viewed as React elements with // different attributes. -var d: React.Element<{doesntmatch: string}> =
; +var d: React.Element<{doesntmatch: string}> =
; // No error as long as expectations are consistent, though. -var e: React.Element<{not_a_real_attr: string}> =
; +var e: React.Element<{not_a_real_attr: string}> =
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // Error: Props<{prop}> ~> Props<{prop1}> // Since intrinsics are typed as \`any\` out of the box, we can pass any // attributes to intrinsics! -// However, we don\'t allow such elements to be viewed as React elements with +// However, we don't allow such elements to be viewed as React elements with // different attributes. // No error as long as expectations are consistent, though. -var React = require(\"react\"); +var React = require("react"); class CustomComponent extends React.Component { props: { prop: string }; } -var a: React.Element<{ prop: string }> = ; -var b: React.Element<{ prop1: string }> = ; -var c: React.Element =
; -var d: React.Element<{ doesntmatch: string }> =
; +var a: React.Element<{ prop: string }> = ; +var b: React.Element<{ prop1: string }> = ; +var c: React.Element =
; +var d: React.Element<{ doesntmatch: string }> =
; var e: React.Element<{ not_a_real_attr: string -}> =
; +}> =
; " `; exports[`test strings.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); // The builtin $JSXIntrinsics should allow any string -var Div = \'div\'; -var Bad = \'bad\'; -var Str: string = \'str\'; +var Div = 'div'; +var Bad = 'bad'; +var Str: string = 'str';
; // This is fine ; // This is fine ; // This is fine -React.createElement(\'div\', {}); // This is fine -React.createElement(\'bad\', {}); // This is fine +React.createElement('div', {}); // This is fine +React.createElement('bad', {}); // This is fine
; // This is fine ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -70,15 +70,15 @@ React.createElement(\'bad\', {}); // This is fine // This is fine /* This is fine*/ // This is fine -var React = require(\"react\"); -var Div = \"div\"; -var Bad = \"bad\"; -var Str: string = \"str\"; +var React = require("react"); +var Div = "div"; +var Bad = "bad"; +var Str: string = "str";
; ; ; -React.createElement(\"div\", {}); -React.createElement(\"bad\", {}); +React.createElement("div", {}); +React.createElement("bad", {});
; " `; diff --git a/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap index f2adad660..a25ce0b35 100644 --- a/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_intrinsics.custom/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test main.js 1`] = ` "// @flow -var React = require(\'react\'); +var React = require('react'); class CustomComponent extends React.Component { props: { @@ -9,46 +9,46 @@ class CustomComponent extends React.Component { }; } -var a: React.Element<{prop: string}> = ; -var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> +var a: React.Element<{prop: string}> = ; +var b: React.Element<{prop1: string}> = ; // Error: Props<{prop}> ~> Props<{prop1}> -
; +
;
; // Error: (\`id\` prop) number ~> string -var c: React.Element<{id: string}> =
; -var d: React.Element<{id: number}> =
; // Error: Props<{id:string}> ~> Props<{id:number}> +var c: React.Element<{id: string}> =
; +var d: React.Element<{id: number}> =
; // Error: Props<{id:string}> ~> Props<{id:number}> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow /* Error: Props<{prop}> ~> Props<{prop1}>*/ // Error: (\`id\` prop) number ~> string // Error: Props<{id:string}> ~> Props<{id:number}> -var React = require(\"react\"); +var React = require("react"); class CustomComponent extends React.Component { props: { prop: string }; } -var a: React.Element<{ prop: string }> = ; -var b: React.Element<{ prop1: string }> = ; -
; +var a: React.Element<{ prop: string }> = ; +var b: React.Element<{ prop1: string }> = ; +
;
; -var c: React.Element<{ id: string }> =
; -var d: React.Element<{ id: number }> =
; +var c: React.Element<{ id: string }> =
; +var d: React.Element<{ id: number }> =
; " `; exports[`test strings.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); -var Div = \'div\'; -var Bad = \'bad\'; -var Str: string = \'str\'; +var Div = 'div'; +var Bad = 'bad'; +var Str: string = 'str';
; // This is fine -; // Error: \'bad\' not in JSXIntrinsics +; // Error: 'bad' not in JSXIntrinsics ; // Error: string ~> keys of JSXIntrinsics -React.createElement(\'div\', {}); // This is fine -React.createElement(\'bad\', {}); // Error: \'bad\' not in JSXIntrinsics +React.createElement('div', {}); // This is fine +React.createElement('bad', {}); // Error: 'bad' not in JSXIntrinsics React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics // TODO: Make this an error @@ -56,22 +56,22 @@ React.createElement(Str, {}); // Error: string ~> keys of JSXIntrinsics ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ /* This is fine*/ -/* Error: \'bad\' not in JSXIntrinsics*/ +/* Error: 'bad' not in JSXIntrinsics*/ // Error: string ~> keys of JSXIntrinsics // This is fine -// Error: \'bad\' not in JSXIntrinsics +// Error: 'bad' not in JSXIntrinsics /* Error: string ~> keys of JSXIntrinsics*/ /* TODO: Make this an error*/ // Not an error but should be eventually -var React = require(\"react\"); -var Div = \"div\"; -var Bad = \"bad\"; -var Str: string = \"str\"; +var React = require("react"); +var Div = "div"; +var Bad = "bad"; +var Str: string = "str";
; ; ; -React.createElement(\"div\", {}); -React.createElement(\"bad\", {}); +React.createElement("div", {}); +React.createElement("bad", {}); React.createElement(Str, {});
; " diff --git a/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap b/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap index 68905bef9..1b17c7e51 100644 --- a/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/jsx_intrinsics.custom/lib/__snapshots__/jsfmt.spec.js.snap @@ -11,8 +11,8 @@ type $JSXIntrinsics = { declare var $React: $Exports<"react">; type $JSXIntrinsic = Class<$React.Component>; type $JSXIntrinsics = { - div: $JSXIntrinsic<{ id: string }>, - span: $JSXIntrinsic<{ id: string, class: string }> + div: $JSXIntrinsic<{ id: string }>; + span: $JSXIntrinsic<{ id: string; class: string }> }; " `; diff --git a/tests/keys/__snapshots__/jsfmt.spec.js.snap b/tests/keys/__snapshots__/jsfmt.spec.js.snap index 5429c131d..76525e8dc 100644 --- a/tests/keys/__snapshots__/jsfmt.spec.js.snap +++ b/tests/keys/__snapshots__/jsfmt.spec.js.snap @@ -1,46 +1,46 @@ exports[`test keys.js 1`] = ` "/* @flow */ -function testKeysOfObject(str: string, lit: \'hi\') { +function testKeysOfObject(str: string, lit: 'hi') { (str: $Keys); // Any string should be fine if (str) { (str: $Keys); // No error, truthy string should be fine } - (\'hi\': $Keys); // String literal should be fine + ('hi': $Keys); // String literal should be fine (123: $Keys); // Error: number -> keys of Object } type StrDict = {[key: string]: mixed}; -function testKeysOfStrDict(str: string, lit: \'hi\') { +function testKeysOfStrDict(str: string, lit: 'hi') { (str: $Keys); // Any string should be fine if (str) { (str: $Keys); // No error, truthy string should be fine } - (\'hi\': $Keys); // String literal should be fine + ('hi': $Keys); // String literal should be fine (123: $Keys); // Error: number -> keys of StrDict } -type StrLitDict = {[key: \'hi\']: mixed}; -function testKeysOfStrLitDict(str: string, lit: \'hi\') { +type StrLitDict = {[key: 'hi']: mixed}; +function testKeysOfStrLitDict(str: string, lit: 'hi') { (str: $Keys); // Error: Not all strings are allowed if (str) { (str: $Keys); // Error: Not all truthy strings are allowed } - (\'hi\': $Keys); // The right string literal is allowed - (\'bye\': $Keys); // Error: The wrong string literal is not allowed + ('hi': $Keys); // The right string literal is allowed + ('bye': $Keys); // Error: The wrong string literal is not allowed (123: $Keys); // Error: number -> keys of StrLitDict } type ObjLit = {hi: mixed}; -function testKeysOfOtherObj(str: string, lit: \'hi\') { +function testKeysOfOtherObj(str: string, lit: 'hi') { (str: $Keys); // Error: string -> keys of ObjLit if (str) { (str: $Keys); // Error: truthy string -> keys of ObjLit } - (\'hi\': $Keys); // String literal should be fine + ('hi': $Keys); // String literal should be fine (123: $Keys); // Error: number -> keys of ObjLit } @@ -63,40 +63,40 @@ function testKeysOfOtherObj(str: string, lit: \'hi\') { // Error: truthy string -> keys of ObjLit // String literal should be fine // Error: number -> keys of ObjLit -function testKeysOfObject(str: string, lit: \"hi\") { +function testKeysOfObject(str: string, lit: "hi") { (str: $Keys); if (str) { (str: $Keys); } - (\"hi\": $Keys); + ("hi": $Keys); (123: $Keys); } type StrDict = { [key: string]: mixed }; -function testKeysOfStrDict(str: string, lit: \"hi\") { +function testKeysOfStrDict(str: string, lit: "hi") { (str: $Keys); if (str) { (str: $Keys); } - (\"hi\": $Keys); + ("hi": $Keys); (123: $Keys); } -type StrLitDict = { [key: \"hi\"]: mixed }; -function testKeysOfStrLitDict(str: string, lit: \"hi\") { +type StrLitDict = { [key: "hi"]: mixed }; +function testKeysOfStrLitDict(str: string, lit: "hi") { (str: $Keys); if (str) { (str: $Keys); } - (\"hi\": $Keys); - (\"bye\": $Keys); + ("hi": $Keys); + ("bye": $Keys); (123: $Keys); } type ObjLit = { hi: mixed }; -function testKeysOfOtherObj(str: string, lit: \"hi\") { +function testKeysOfOtherObj(str: string, lit: "hi") { (str: $Keys); if (str) { (str: $Keys); } - (\"hi\": $Keys); + ("hi": $Keys); (123: $Keys); } " diff --git a/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap b/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap index 78425ba02..aea2ff688 100644 --- a/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap +++ b/tests/last_duplicate_property_wins/__snapshots__/jsfmt.spec.js.snap @@ -5,13 +5,13 @@ exports[`test test.js 1`] = ` class C { foo(): number { return 0; } - foo(): string { return \"hello\" } // last wins + foo(): string { return "hello" } // last wins x: number; x: string; // last wins bar(): number { return 0; } bar: string; // field wins over method qux: number; - qux(): string { return \"hello\" } // method loses to field! + qux(): string { return "hello" } // method loses to field! } // check @@ -19,19 +19,19 @@ class C { ((new C).foo(): boolean); // last wins ((new C).x: boolean); // last wins ((new C).bar: boolean); // last wins -((new C).qux: boolean); // weird outlier where last doesn\'t win in classes +((new C).qux: boolean); // weird outlier where last doesn't win in classes // Objects const o = { foo(): number { return 0; }, - foo(): string { return \"hello\" }, // last wins + foo(): string { return "hello" }, // last wins x: 42, - x: \"hello\", // last wins + x: "hello", // last wins bar(): number { return 0; }, - bar: \"hello\", // last wins + bar: "hello", // last wins qux: 42, - qux(): string { return \"hello\" }, // last wins + qux(): string { return "hello" }, // last wins }; // check @@ -51,7 +51,7 @@ const o = { // last wins // last wins // last wins -// weird outlier where last doesn\'t win in classes +// weird outlier where last doesn't win in classes // Objects // last wins // last wins @@ -67,7 +67,7 @@ class C { return 0; } foo(): string { - return \"hello\"; + return "hello"; } x: number; x: string; @@ -77,7 +77,7 @@ class C { bar: string; qux: number; qux(): string { - return \"hello\"; + return "hello"; } } (new C().foo(): boolean); @@ -89,17 +89,17 @@ const o = { return 0; }, foo(): string { - return \"hello\"; + return "hello"; }, x: 42, - x: \"hello\", + x: "hello", bar(): number { return 0; }, - bar: \"hello\", + bar: "hello", qux: 42, qux(): string { - return \"hello\"; + return "hello"; } }; (o.foo(): boolean); diff --git a/tests/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap b/tests/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap index d95778fb7..4200b005e 100644 --- a/tests/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap +++ b/tests/lib_interfaces/declarations/__snapshots__/jsfmt.spec.js.snap @@ -7,7 +7,7 @@ interface CArrays extends C> { bar(): C; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -interface C extends { foo: : () => CArrays, bar: : () => C } -interface CArrays extends C> { bar: : () => C } +interface C { foo(): CArrays; bar(): C } +interface CArrays extends C> { bar(): C } " `; diff --git a/tests/liberr/libs/__snapshots__/jsfmt.spec.js.snap b/tests/liberr/libs/__snapshots__/jsfmt.spec.js.snap index f33908304..59ecef80f 100644 --- a/tests/liberr/libs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/liberr/libs/__snapshots__/jsfmt.spec.js.snap @@ -1,23 +1,3 @@ -exports[`test parse_error.js 1`] = ` -"/** - * @flow - */ -declare class ExampleClass { - - methodA: () => any // parse error, missing comma - - methodB: () => any - -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * @flow - */ -// parse error, missing comma -declare class ExampleClass { methodA: : () => any, methodB: : () => any } -" -`; - exports[`test type_error.js 1`] = ` "// @flow declare function foo(x: number): Array; diff --git a/tests/liberr/libs/parse_error.js b/tests/liberr/libs/parse_error.js deleted file mode 100644 index 08cd2a15d..000000000 --- a/tests/liberr/libs/parse_error.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @flow - */ -declare class ExampleClass { - - methodA: () => any // parse error, missing comma - - methodB: () => any - -} diff --git a/tests/literal/__snapshots__/jsfmt.spec.js.snap b/tests/literal/__snapshots__/jsfmt.spec.js.snap index 60a307f57..95f1639dc 100644 --- a/tests/literal/__snapshots__/jsfmt.spec.js.snap +++ b/tests/literal/__snapshots__/jsfmt.spec.js.snap @@ -1,53 +1,53 @@ exports[`test enum.js 1`] = ` "var APIKeys = { - AGE: \'age\', - NAME: \'name\', + AGE: 'age', + NAME: 'name', }; module.exports = APIKeys; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var APIKeys = { AGE: \"age\", NAME: \"name\" }; +var APIKeys = { AGE: "age", NAME: "name" }; module.exports = APIKeys; " `; exports[`test enum_client.js 1`] = ` -"var APIKeys = require(\'./enum\'); -// object that maps \"AGE\" to \"age\", \"NAME\" to \"name\" +"var APIKeys = require('./enum'); +// object that maps "AGE" to "age", "NAME" to "name" function foo(x: $Keys) { } -foo(\"AGE\"); -foo(\"LOCATION\"); // error +foo("AGE"); +foo("LOCATION"); // error function bar(x: $Keys<{age: number}>) { } -bar(APIKeys.AGE); // not an error: APIKeys.AGE = \"age\" -bar(APIKeys.NAME); // error: since \"NAME\" is not in the smaller enum +bar(APIKeys.AGE); // not an error: APIKeys.AGE = "age" +bar(APIKeys.NAME); // error: since "NAME" is not in the smaller enum var object = {}; object[APIKeys.AGE] = 123; // i.e., object.age = 123 -object[APIKeys.NAME] = \"FOO\"; // i.e., object.name = \"FOO\" +object[APIKeys.NAME] = "FOO"; // i.e., object.name = "FOO" var age:number = object[APIKeys.AGE]; var name:number = object[APIKeys.NAME]; // error: object.name is a string var indices = { red: 0, green: 1, blue: 2 }; -var tuple = [42, \"hello\", false]; +var tuple = [42, "hello", false]; var red:string = tuple[indices.red]; // error: tuple[0] is a number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// object that maps \"AGE\" to \"age\", \"NAME\" to \"name\" +// object that maps "AGE" to "age", "NAME" to "name" // error -// not an error: APIKeys.AGE = \"age\" -// error: since \"NAME\" is not in the smaller enum +// not an error: APIKeys.AGE = "age" +// error: since "NAME" is not in the smaller enum // i.e., object.age = 123 -// i.e., object.name = \"FOO\" +// i.e., object.name = "FOO" // error: object.name is a string // error: tuple[0] is a number -var APIKeys = require(\"./enum\"); +var APIKeys = require("./enum"); function foo(x: $Keys) { } -foo(\"AGE\"); -foo(\"LOCATION\"); +foo("AGE"); +foo("LOCATION"); function bar(x: $Keys<{ age: number }>) { } @@ -55,11 +55,11 @@ bar(APIKeys.AGE); bar(APIKeys.NAME); var object = {}; object[APIKeys.AGE] = 123; -object[APIKeys.NAME] = \"FOO\"; +object[APIKeys.NAME] = "FOO"; var age: number = object[APIKeys.AGE]; var name: number = object[APIKeys.NAME]; var indices = { red: 0, green: 1, blue: 2 }; -var tuple = [ 42, \"hello\", false ]; +var tuple = [ 42, "hello", false ]; var red: string = tuple[indices.red]; " `; @@ -73,8 +73,8 @@ function test2(x: string): number { return -x; } -// sanity checks to make sure merging envs doesn\'t keep creating new NumT\'s -// because of the UnaryMinusT\'s, causing nontermination +// sanity checks to make sure merging envs doesn't keep creating new NumT's +// because of the UnaryMinusT's, causing nontermination function test3(x: number, flip_times: number): number { for (var i = 0; i < flip_times; i++) { x = -x; @@ -89,8 +89,8 @@ function test4(flip_times: number): number { return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// sanity checks to make sure merging envs doesn\'t keep creating new NumT\'s -// because of the UnaryMinusT\'s, causing nontermination +// sanity checks to make sure merging envs doesn't keep creating new NumT's +// because of the UnaryMinusT's, causing nontermination function test1(x: number): number { return -x; } diff --git a/tests/locals/__snapshots__/jsfmt.spec.js.snap b/tests/locals/__snapshots__/jsfmt.spec.js.snap index db1a3e123..26cb0450d 100644 --- a/tests/locals/__snapshots__/jsfmt.spec.js.snap +++ b/tests/locals/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test lex.js 1`] = ` "function switch_scope(x: mixed) { - let a = \"\"; - let b = \"\"; + let a = ""; + let b = ""; switch (x) { - case \"foo\": + case "foo": let a; - a = 0; // doesn\'t add lower bound to outer a + a = 0; // doesn't add lower bound to outer a b = 0; } (a : string); // OK @@ -16,11 +16,11 @@ function try_scope_finally() { let a; let b; try { - a = \"\"; - b = \"\"; + a = ""; + b = ""; } finally { let a; - a = 0; // doesn\'t add lower bound to outer a + a = 0; // doesn't add lower bound to outer a b = 0; } (a : string); // ok @@ -28,10 +28,10 @@ function try_scope_finally() { } function for_scope() { - let a = \"\"; - let b = \"\"; + let a = ""; + let b = ""; for (let a;;) { - a = 0; // doesn\'t add lower bound to outer a + a = 0; // doesn't add lower bound to outer a b = 0; } (a : string); @@ -42,41 +42,41 @@ function for_in_scope(o: Object) { let a = 0; let b = 0; for (let a in o) { - a = \"\"; // doesn\'t add lower bound to outer a - b = \"\"; + a = ""; // doesn't add lower bound to outer a + b = ""; } (a : number); (b : number); // error: string ~> number } function for_of_scope(xs: number[]) { - let a = \"\"; - let b = \"\"; + let a = ""; + let b = ""; for (let a of xs) { - a = 0; // doesn\'t add lower bound to outer a + a = 0; // doesn't add lower bound to outer a b = 0; } (a : string); (b : string); // error: number ~> string } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// doesn\'t add lower bound to outer a +// doesn't add lower bound to outer a // OK // error: number ~> string -// doesn\'t add lower bound to outer a +// doesn't add lower bound to outer a // ok // error: number ~> string -// doesn\'t add lower bound to outer a +// doesn't add lower bound to outer a // error: number ~> string -// doesn\'t add lower bound to outer a +// doesn't add lower bound to outer a // error: string ~> number -// doesn\'t add lower bound to outer a +// doesn't add lower bound to outer a // error: number ~> string function switch_scope(x: mixed) { - let a = \"\"; - let b = \"\"; + let a = ""; + let b = ""; switch (x) { - case \"foo\": + case "foo": let a; a = 0; b = 0; @@ -88,8 +88,8 @@ function try_scope_finally() { let a; let b; try { - a = \"\"; - b = \"\"; + a = ""; + b = ""; } finally { let a; a = 0; @@ -99,8 +99,8 @@ function try_scope_finally() { (b: string); } function for_scope() { - let a = \"\"; - let b = \"\"; + let a = ""; + let b = ""; for (let a; ; ) { a = 0; b = 0; @@ -112,15 +112,15 @@ function for_in_scope(o: Object) { let a = 0; let b = 0; for (let a in o) { - a = \"\"; - b = \"\"; + a = ""; + b = ""; } (a: number); (b: number); } function for_of_scope(xs: number[]) { - let a = \"\"; - let b = \"\"; + let a = ""; + let b = ""; for (let a of xs) { a = 0; b = 0; @@ -151,7 +151,7 @@ function sorry(really: bool) { function foo0(b: bool): number { var x = 0; if (b) { - var x = \"\"; // error: string ~> number + var x = ""; // error: string ~> number } return x; } @@ -174,7 +174,7 @@ function sorry(really: boolean) { function foo0(b: boolean): number { var x = 0; if (b) { - var x = \"\"; + var x = ""; } return x; } diff --git a/tests/logical/__snapshots__/jsfmt.spec.js.snap b/tests/logical/__snapshots__/jsfmt.spec.js.snap index 77d9ffa33..9b5348987 100644 --- a/tests/logical/__snapshots__/jsfmt.spec.js.snap +++ b/tests/logical/__snapshots__/jsfmt.spec.js.snap @@ -969,10 +969,10 @@ function logical18a(x: number, y: number): number { function logical18b(x: { a: number }, y: { b: number }): number { return x.a - 1 || y.b - 1; } -function logical19a(x: { y: string, z: boolean }): boolean { +function logical19a(x: { y: string; z: boolean }): boolean { return x.y && x.z; } -function logical19b(x: { y: string, z: boolean }): boolean { +function logical19b(x: { y: string; z: boolean }): boolean { return x.y || x.z; } " diff --git a/tests/loners/__snapshots__/jsfmt.spec.js.snap b/tests/loners/__snapshots__/jsfmt.spec.js.snap index c106f6c09..37c7f72b8 100644 --- a/tests/loners/__snapshots__/jsfmt.spec.js.snap +++ b/tests/loners/__snapshots__/jsfmt.spec.js.snap @@ -13,7 +13,7 @@ module.exports = export_f; var o = { x: 5, y: \"jello\" }; var z = o.z; var export_o: { x: number } = o; -function f(u, v): number { +function f(u, v?): number { return u; } var export_f: (u: number) => number = f; diff --git a/tests/method_properties/__snapshots__/jsfmt.spec.js.snap b/tests/method_properties/__snapshots__/jsfmt.spec.js.snap index 1575305f9..d06574ab6 100644 --- a/tests/method_properties/__snapshots__/jsfmt.spec.js.snap +++ b/tests/method_properties/__snapshots__/jsfmt.spec.js.snap @@ -8,7 +8,7 @@ declare class Foo { export {Foo}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -declare class Foo { bar?: : () => string } +declare class Foo { bar?(): string } export { Foo } " `; diff --git a/tests/misc/__snapshots__/jsfmt.spec.js.snap b/tests/misc/__snapshots__/jsfmt.spec.js.snap index 46f10dc80..9597ac3b9 100644 --- a/tests/misc/__snapshots__/jsfmt.spec.js.snap +++ b/tests/misc/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ module.exports.cls = A; function f(x:boolean) { } module.exports.fn = f; -A.y = \"?\"; +A.y = "?"; A.x = A.y; f(A.x); // A.x is now a string, by def assign ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -23,7 +23,7 @@ function f(x: boolean) { } module.exports.fn = f; -A.y = \"?\"; +A.y = "?"; A.x = A.y; f(A.x); " @@ -33,10 +33,10 @@ exports[`test B.js 1`] = ` " /* @providesModule B */ -var A = require(\'A\').cls; +var A = require('A').cls; function B() { - this.b = \"...\"; + this.b = "..."; } function f():number { return this.b; } @@ -47,9 +47,9 @@ B.prototype.fn = f; module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule B */ -var A = require(\"A\").cls; +var A = require("A").cls; function B() { - this.b = \"...\"; + this.b = "..."; } function f(): number { return this.b; @@ -64,8 +64,8 @@ exports[`test C.js 1`] = ` " /* @providesModule C */ -var B = require(\'B\'); -var f = require(\'A\').fn; +var B = require('B'); +var f = require('A').fn; function C() { var o = new B(); @@ -77,8 +77,8 @@ function C() { module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule C */ -var B = require(\"B\"); -var f = require(\"A\").fn; +var B = require("B"); +var f = require("A").fn; function C() { var o = new B(); f(o.b); @@ -93,7 +93,7 @@ exports[`test D.js 1`] = ` " /* @providesModule D */ -var f = require(\'A\').fn; +var f = require('A').fn; function g():string { return this.i; } @@ -103,10 +103,10 @@ o.i = true; var i = o.fn(); f(i); -module.exports = \"D for dummy\"; +module.exports = "D for dummy"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule D */ -var f = require(\"A\").fn; +var f = require("A").fn; function g(): string { return this.i; } @@ -114,7 +114,7 @@ var o = { fn: g, ...{} }; o.i = true; var i = o.fn(); f(i); -module.exports = \"D for dummy\"; +module.exports = "D for dummy"; " `; @@ -143,7 +143,7 @@ module.exports = { obj: o }; exports[`test F.js 1`] = ` "function fn2(x) { return x.length * 4; } -fn2({length: \'hi\'}); +fn2({length: 'hi'}); function foo(x: Array): string { return x.length; @@ -152,7 +152,7 @@ function foo(x: Array): string { function fn2(x) { return x.length * 4; } -fn2({ length: \"hi\" }); +fn2({ length: "hi" }); function foo(x: Array): string { return x.length; } @@ -160,19 +160,19 @@ function foo(x: Array): string { `; exports[`test G.js 1`] = ` -"var a = { length: \"duck\" }; +"var a = { length: "duck" }; a.length = 123; a.length(); var b = [ 123 ]; -b.length = \"duck\"; +b.length = "duck"; b.length(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var a = { length: \"duck\" }; +var a = { length: "duck" }; a.length = 123; a.length(); var b = [ 123 ]; -b.length = \"duck\"; +b.length = "duck"; b.length(); " `; diff --git a/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap b/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap index 1ac16e790..fc83ea8d3 100644 --- a/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/modified_lib/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test test.js 1`] = ` "// @flow -import {bar} from \'foo\'; +import {bar} from 'foo'; bar(5); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { bar } from \"foo\"; +import { bar } from "foo"; bar(5); " `; diff --git a/tests/modules/__snapshots__/jsfmt.spec.js.snap b/tests/modules/__snapshots__/jsfmt.spec.js.snap index 1472c43d7..2e0663a69 100644 --- a/tests/modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/modules/__snapshots__/jsfmt.spec.js.snap @@ -1,12 +1,12 @@ exports[`test cli.js 1`] = ` "/* @flow */ -var f = require(\'./lib\'); +var f = require('./lib'); var y:number = f(0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var f = require(\"./lib\"); +var f = require("./lib"); var y: number = f(0); " `; @@ -14,13 +14,13 @@ var y: number = f(0); exports[`test cli2.js 1`] = ` "/* @flow */ -var f = require(\'./lib\'); +var f = require('./lib'); -f(\"...\"); +f("..."); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var f = require(\"./lib\"); -f(\"...\"); +var f = require("./lib"); +f("..."); " `; diff --git a/tests/more_annot/__snapshots__/jsfmt.spec.js.snap b/tests/more_annot/__snapshots__/jsfmt.spec.js.snap index 9e3cb531e..73d4cf6c5 100644 --- a/tests/more_annot/__snapshots__/jsfmt.spec.js.snap +++ b/tests/more_annot/__snapshots__/jsfmt.spec.js.snap @@ -42,7 +42,7 @@ function Foo() { Foo.prototype.m = function() { }; -var o1: { x: number, m: : () => void } = new Foo(); +var o1: { x: number; m(): void } = new Foo(); var o2: Foo = new Foo(); " `; @@ -59,6 +59,6 @@ class C { } } class D extends C {} -var d: { +m: : () => void } = new D(); +var d: { +m: () => void } = new D(); " `; diff --git a/tests/more_path/__snapshots__/jsfmt.spec.js.snap b/tests/more_path/__snapshots__/jsfmt.spec.js.snap index 3a6ae913f..4fb617aac 100644 --- a/tests/more_path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/more_path/__snapshots__/jsfmt.spec.js.snap @@ -2,10 +2,10 @@ exports[`test Condition.js 1`] = ` "/* @providesModule Condition */ function f(x:number) { } -function g() { return (42 || \"hello\"); } +function g() { return (42 || "hello"); } var x = g(); -if (typeof x === \"string\") { +if (typeof x === "string") { x = 0; } f(x); @@ -25,7 +25,7 @@ class C { qux() { } } function foo() { - var c = \"...\"; + var c = "..."; c = new C(); if (bar()) { c.qux(); @@ -35,20 +35,20 @@ function foo() { function goofy() { var x = g(); - if (typeof x == \'function\') { + if (typeof x == 'function') { x(); - } else { // if (typeof x == \'number\') { + } else { // if (typeof x == 'number') { //f(x); } } function goofy2() { var o = {x : 0} - if (typeof o.x == \'function\') { + if (typeof o.x == 'function') { o.x(); } var y = o.x; - if (typeof y == \'function\') { + if (typeof y == 'function') { y(); } else { //f(y); @@ -59,17 +59,17 @@ module.exports = true; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Condition */ //f(y); -// if (typeof x == \'number\') { +// if (typeof x == 'number') { //f(x); //f(y); function f(x: number) { } function g() { - return 42 || \"hello\"; + return 42 || "hello"; } var x = g(); -if (typeof x === \"string\") { +if (typeof x === "string") { x = 0; } f(x); @@ -90,7 +90,7 @@ class C { } } function foo() { - var c = \"...\"; + var c = "..."; c = new C(); if (bar()) { c.qux(); @@ -98,7 +98,7 @@ function foo() { } function goofy() { var x = g(); - if (typeof x == \"function\") { + if (typeof x == "function") { x(); } else { @@ -106,11 +106,11 @@ function goofy() { } function goofy2() { var o = { x: 0 }; - if (typeof o.x == \"function\") { + if (typeof o.x == "function") { o.x(); } var y = o.x; - if (typeof y == \"function\") { + if (typeof y == "function") { y(); } else { @@ -128,7 +128,7 @@ function check(x:string) { } function FlowSA() { var x = 0; - x = \"...\"; + x = "..."; check(x); } @@ -140,7 +140,7 @@ function check(x: string) { } function FlowSA() { var x = 0; - x = \"...\"; + x = "..."; check(x); } module.exports = FlowSA; @@ -183,18 +183,18 @@ class D { d() {} } function baz(x:D) { if (x instanceof A) { - // unreachable, TODO: this shouldn\'t throw + // unreachable, TODO: this shouldn't throw } } -module.exports = \"sigma\"; +module.exports = "sigma"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule Sigma */ // error // TODO no error? since unreachable (x: B implies x: A) // error // error -// unreachable, TODO: this shouldn\'t throw +// unreachable, TODO: this shouldn't throw class A { a() { @@ -239,7 +239,7 @@ function baz(x: D) { } } -module.exports = \"sigma\"; +module.exports = "sigma"; " `; diff --git a/tests/more_react/__snapshots__/jsfmt.spec.js.snap b/tests/more_react/__snapshots__/jsfmt.spec.js.snap index 7f5319019..9b369dea3 100644 --- a/tests/more_react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/more_react/__snapshots__/jsfmt.spec.js.snap @@ -1,17 +1,17 @@ exports[`test API.react.js 1`] = ` " -var app = require(\'JSX\'); +var app = require('JSX'); app.setProps({y:42}); // error, y:number but foo expects string in App.react app.setState({z:42}); // error, z:number but foo expects string in App.react function bar(x:number) { } -bar(app.props.children); // No error, App doesn\'t specify propTypes so anything goes +bar(app.props.children); // No error, App doesn't specify propTypes so anything goes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error, y:number but foo expects string in App.react // error, z:number but foo expects string in App.react -// No error, App doesn\'t specify propTypes so anything goes -var app = require(\"JSX\"); +// No error, App doesn't specify propTypes so anything goes +var app = require("JSX"); app.setProps({ y: 42 }); app.setState({ z: 42 }); function bar(x: number) { @@ -28,7 +28,7 @@ exports[`test App.react.js 1`] = ` * @jsx React.DOM */ -var React = require(\'react\'); +var React = require('react'); // expect args to be strings function foo(p:string,q:string):string { return p+q; } @@ -36,7 +36,7 @@ function foo(p:string,q:string):string { return p+q; } var App = React.createClass({ getDefaultProps: function(): { y: string } { - return {y:\"\"}; // infer props.y: string + return {y:""}; // infer props.y: string }, getInitialState: function() { @@ -75,13 +75,13 @@ module.exports = App; // infer state.z: number // ok //this.state; -var React = require(\"react\"); +var React = require("react"); function foo(p: string, q: string): string { return p + q; } var App = React.createClass({ getDefaultProps: function(): { y: string } { - return { y: \"\" }; + return { y: "" }; }, getInitialState: function() { return { z: 0 }; @@ -108,8 +108,8 @@ exports[`test JSX.js 1`] = ` " /* @providesModule JSX */ -var React = require(\'react\'); -var App = require(\'App.react\'); +var React = require('react'); +var App = require('App.react'); var app = // error, y: number but foo expects string in App.react @@ -119,15 +119,15 @@ var app = module.exports = app; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @providesModule JSX */ -var React = require(\"react\"); -var App = require(\"App.react\"); +var React = require("react"); +var App = require("App.react"); var app = // error, y: number but foo expects string in App.react[object Object] Some text.; module.exports = app; " `; exports[`test propTypes.js 1`] = ` -"var React = require(\'React\'); +"var React = require('React'); var C = React.createClass({ propTypes: { @@ -142,19 +142,19 @@ var D = React.createClass({ }); ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* error (as usual)*/ /* OK (error ignored when spread is used)*/ -var React = require(\"React\"); +var React = require("React"); var C = React.createClass({ propTypes: { title: React.PropTypes.string.isRequired } }); var D = React.createClass({ propTypes: { name: React.PropTypes.string.isRequired, ...C.propTypes } }); -; +; " `; diff --git a/tests/namespace/__snapshots__/jsfmt.spec.js.snap b/tests/namespace/__snapshots__/jsfmt.spec.js.snap index 3b2c401ee..403ae9904 100644 --- a/tests/namespace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/namespace/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test client.js 1`] = ` -"var ns = require(\'./namespace\') +"var ns = require('./namespace') var bar: string = ns.foo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var ns = require(\"./namespace\"); +var ns = require("./namespace"); var bar: string = ns.foo; " `; exports[`test namespace.js 1`] = ` -"/*@flow*/// import type { T } from \'...\' +"/*@flow*/// import type { T } from '...' type T = (x:number) => void; var f: T = function(x:string): void { } @@ -19,28 +19,28 @@ function bar(x:U, f:Map): V { return f(x); } -var y:number = bar(0, x => \"\"); +var y:number = bar(0, x => ""); type Seq = number | Array; var s1:Seq = [0,[0]]; -var s2:Seq = [[\"\"]]; +var s2:Seq = [[""]]; -module.exports = { foo: (\"\": number) }; +module.exports = { foo: ("": number) }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /*@flow*/ -// import type { T } from \'...\' -type T = : (x: number) => void; +// import type { T } from '...' +type T = (x: number) => void; var f: T = function(x: string): void { }; -type Map = : (x: X) => Y; +type Map = (x: X) => Y; function bar(x: U, f: Map): V { return f(x); } -var y: number = bar(0, x => \"\"); +var y: number = bar(0, x => ""); type Seq = number | Array; var s1: Seq = [ 0, [ 0 ] ]; -var s2: Seq = [ [ \"\" ] ]; -module.exports = { foo: (\"\": number) }; +var s2: Seq = [ [ "" ] ]; +module.exports = { foo: ("": number) }; " `; diff --git a/tests/new_react/__snapshots__/jsfmt.spec.js.snap b/tests/new_react/__snapshots__/jsfmt.spec.js.snap index a87aa56ff..3df692363 100644 --- a/tests/new_react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/new_react/__snapshots__/jsfmt.spec.js.snap @@ -6,28 +6,28 @@ exports[`test FeedUFI.react.js 1`] = ` * @flow */ -\'use strict\'; +'use strict'; -var UFILikeCount = require(\'UFILikeCount.react\'); -var React = require(\'react\'); +var UFILikeCount = require('UFILikeCount.react'); +var React = require('react'); var FeedUFI = React.createClass({ _renderLikeCount: function( feedback: any ) { var props = { - className: \"\", - key: \"\", + className: "", + key: "", feedback: {feedback}, - permalink: \"\", + permalink: "", }; var ignored = ; return ( ); }, @@ -48,19 +48,19 @@ module.exports = FeedUFI; * @providesModule FeedUFI.react * @flow */ -\"use strict\"; -var UFILikeCount = require(\"UFILikeCount.react\"); -var React = require(\"react\"); +"use strict"; +var UFILikeCount = require("UFILikeCount.react"); +var React = require("react"); var FeedUFI = React.createClass({ _renderLikeCount: function(feedback: any) { var props = { - className: \"\", - key: \"\", + className: "", + key: "", feedback: { feedback }, - permalink: \"\" + permalink: "" }; var ignored = ; - return ; + return ; }, render: function(): ?React.Element { return
; @@ -93,9 +93,9 @@ exports[`test UFILikeCount.react.js 1`] = ` * @flow */ -\'use strict\'; +'use strict'; -var React = require(\'react\'); +var React = require('react'); var UFILikeCount = React.createClass({ propTypes: { @@ -116,8 +116,8 @@ module.exports = UFILikeCount; * @providesModule UFILikeCount.react * @flow */ -\"use strict\"; -var React = require(\"react\"); +"use strict"; +var React = require("react"); var UFILikeCount = React.createClass({ propTypes: { permalink: React.PropTypes.string, @@ -132,7 +132,7 @@ module.exports = UFILikeCount; `; exports[`test bad_default_props.js 1`] = ` -"var React = require(\'React\'); +"var React = require('React'); type T1 = { } type T2 = { x: number } @@ -171,10 +171,10 @@ class C6 extends React.Component { // OK, recommended // no need to declare defaultProps unless necessary // error // OK, recommended -var React = require(\"React\"); +var React = require("React"); type T1 = {}; type T2 = { x: number }; -type T3 = { x: number, y: number }; +type T3 = { x: number; y: number }; class C1 extends React.Component {} class C2 extends React.Component {} class C3 extends React.Component { @@ -193,7 +193,7 @@ class C6 extends React.Component { `; exports[`test classes.js 1`] = ` -"var React = require(\'React\'); +"var React = require('React'); type DefaultProps = { }; type Props = { x: number }; @@ -214,7 +214,7 @@ class Foo extends React.Component { constructor(props) { super(props); - this.state = { y: \"\" }; + this.state = { y: "" }; } setState(o: { y_: string }): void { } @@ -255,7 +255,7 @@ var FooLegacy = React.createClass({ }, getInitialState(): { y: string } { - return { y: \"\" }; + return { y: "" }; }, setState(o: { y_: string }): void { }, @@ -278,7 +278,7 @@ var foo_legacy: $jsx = ; FooLegacy.bar(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // TODO: should be error -var React = require(\"React\"); +var React = require("React"); type DefaultProps = {}; type Props = { x: number }; type State = { y: number }; @@ -295,7 +295,7 @@ class Foo extends React.Component { } constructor(props) { super(props); - this.state = { y: \"\" }; + this.state = { y: "" }; } setState(o: { y_: string }): void { @@ -325,7 +325,7 @@ var FooLegacy = React.createClass({ var _: string = this.props.x; }, getInitialState(): { y: string } { - return { y: \"\" }; + return { y: "" }; }, setState(o: { y_: string }): void { @@ -348,45 +348,45 @@ exports[`test import-react.js 1`] = ` // Testing local binding of React in all kinds of ways. The only reason this // might even be an issue is that internally, the use of JSX triggers an -// implicit require(\'react\'), so any bugs in (1) interop of CJS require and ES6 -// import (2) module re-export, as used to redirect the module name \'React\' to -// \'react\' might show up here. +// implicit require('react'), so any bugs in (1) interop of CJS require and ES6 +// import (2) module re-export, as used to redirect the module name 'React' to +// 'react' might show up here. -import React from \"react\"; -//import React from \"React\"; -//var React = require(\"react\"); -//var React = require(\"React\"); +import React from "react"; +//import React from "React"; +//var React = require("react"); +//var React = require("React"); class HelloMessage extends React.Component { props: { name: string }; } ; // number ~/~> string error -; // ok +; // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Testing local binding of React in all kinds of ways. The only reason this // might even be an issue is that internally, the use of JSX triggers an -// implicit require(\'react\'), so any bugs in (1) interop of CJS require and ES6 -// import (2) module re-export, as used to redirect the module name \'React\' to -// \'react\' might show up here. -//import React from \"React\"; -//var React = require(\"react\"); -//var React = require(\"React\"); +// implicit require('react'), so any bugs in (1) interop of CJS require and ES6 +// import (2) module re-export, as used to redirect the module name 'React' to +// 'react' might show up here. +//import React from "React"; +//var React = require("react"); +//var React = require("React"); /* number ~/~> string error*/ // ok -import React from \"react\"; +import React from "react"; class HelloMessage extends React.Component { props: { name: string }; } ; -; +; " `; exports[`test new_react.js 1`] = ` -"var React = require(\'react\'); -var Mixin = require(\'Mixin\'); +"var React = require('react'); +var Mixin = require('Mixin'); var C = React.createClass({ mixins: [Mixin], propTypes: { @@ -418,8 +418,8 @@ var element_ = ; var x: number = C.displayName; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\"react\"); -var Mixin = require(\"Mixin\"); +var React = require("react"); +var Mixin = require("Mixin"); var C = React.createClass({ mixins: [ Mixin ], propTypes: { @@ -454,7 +454,7 @@ var x: number = C.displayName; `; exports[`test propTypes.js 1`] = ` -"var React = require(\'react\'); +"var React = require('react'); var PropTypes = React.PropTypes; var C = React.createClass({ @@ -468,17 +468,17 @@ var C = React.createClass({ ; // error (label is required, value not required) var props: Array<{label: string, value?: number}> = [ {}, - {label:\"\",value:undefined}, + {label:"",value:undefined}, ]; // error (same as ^) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error (label is required, value not required) // error (same as ^) -var React = require(\"react\"); +var React = require("react"); var PropTypes = React.PropTypes; var C = React.createClass({ propTypes: { @@ -490,16 +490,16 @@ var C = React.createClass({ ).isRequired } }); -; -var props: Array<{ label: string, value?: number }> = [ +; +var props: Array<{ label: string; value?: number }> = [ {}, - { label: \"\", value: undefined } + { label: "", value: undefined } ]; " `; exports[`test props.js 1`] = ` -"var React = require(\'react\'); +"var React = require('react'); var TestProps = React.createClass({ propTypes: { @@ -508,7 +508,7 @@ var TestProps = React.createClass({ }, getDefaultProps: function() { - return {x: \'\', y: 0} + return {x: '', y: 0} }, test: function() { @@ -531,11 +531,11 @@ var FooProps = React.createClass({ // error // error // 3 errors -var React = require(\"react\"); +var React = require("react"); var TestProps = React.createClass({ propTypes: { x: React.PropTypes.string, z: React.PropTypes.number }, getDefaultProps: function() { - return { x: \"\", y: 0 }; + return { x: "", y: 0 }; }, test: function() { var a: number = this.props.x; @@ -554,7 +554,7 @@ var FooProps = React.createClass({ `; exports[`test props2.js 1`] = ` -"var React = require(\'react\'); +"var React = require('react'); var C = React.createClass({ propTypes: { foo: React.PropTypes.string.isRequired, @@ -572,7 +572,7 @@ var D = React.createClass({ } }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\"react\"); +var React = require("react"); var C = React.createClass({ propTypes: { foo: React.PropTypes.string.isRequired, @@ -593,7 +593,7 @@ var D = React.createClass({ `; exports[`test props3.js 1`] = ` -"var React = require(\'react\'); +"var React = require('react'); var TestProps = React.createClass({ // Do something illegal inside of propTypes and make sure Flow notices propTypes: { @@ -623,8 +623,8 @@ var TestProps = React.createClass({ instanceOf_rec: React.PropTypes.instanceOf(Object).isRequired, objectOf: React.PropTypes.objectOf(React.PropTypes.string), objectOf_rec: React.PropTypes.objectOf(React.PropTypes.string).isRequired, - oneOf: React.PropTypes.oneOf([\"yes\", \"no\"]), - oneOf_rec: React.PropTypes.oneOf([\"yes\", \"no\"]).isRequired, + oneOf: React.PropTypes.oneOf(["yes", "no"]), + oneOf_rec: React.PropTypes.oneOf(["yes", "no"]).isRequired, oneOfType: React.PropTypes.oneOfType( [React.PropTypes.string, React.PropTypes.number] ), @@ -648,7 +648,7 @@ var TestProps = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Do something illegal inside of propTypes and make sure Flow notices // And do something bad here -var React = require(\"react\"); +var React = require("react"); var TestProps = React.createClass({ propTypes: { arr: React.PropTypes.array, @@ -675,8 +675,8 @@ var TestProps = React.createClass({ instanceOf_rec: React.PropTypes.instanceOf(Object).isRequired, objectOf: React.PropTypes.objectOf(React.PropTypes.string), objectOf_rec: React.PropTypes.objectOf(React.PropTypes.string).isRequired, - oneOf: React.PropTypes.oneOf([ \"yes\", \"no\" ]), - oneOf_rec: React.PropTypes.oneOf([ \"yes\", \"no\" ]).isRequired, + oneOf: React.PropTypes.oneOf([ "yes", "no" ]), + oneOf_rec: React.PropTypes.oneOf([ "yes", "no" ]).isRequired, oneOfType: React.PropTypes.oneOfType( [ React.PropTypes.string, React.PropTypes.number ] ), @@ -701,7 +701,7 @@ var TestProps = React.createClass({ exports[`test props4.js 1`] = ` "// @flow -import React from \"React\"; +import React from "React"; class JDiv extends React.Component { // static defaultProps: { }; @@ -710,7 +710,7 @@ class JDiv extends React.Component { }; } -// Should be a type error (\'id\' takes a string, not a number..) +// Should be a type error ('id' takes a string, not a number..) ; class Example extends React.Component { @@ -722,14 +722,14 @@ class Example extends React.Component { } React.render( - , + , document.body ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // static defaultProps: { }; -/* Should be a type error (\'id\' takes a string, not a number..)*/ -import React from \"React\"; +/* Should be a type error ('id' takes a string, not a number..)*/ +import React from "React"; class JDiv extends React.Component { props: { id: string }; } @@ -740,12 +740,12 @@ class Example extends React.Component { return
{this.props.bar}
; } } -React.render(, document.body); +React.render(, document.body); " `; exports[`test props5.js 1`] = ` -"var React = require(\'React\'); +"var React = require('React'); var C = React.createClass({ getDefaultProps: function() { @@ -755,7 +755,7 @@ var C = React.createClass({ module.exports = C; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\"React\"); +var React = require("React"); var C = React.createClass({ getDefaultProps: function() { return { x: 0 }; @@ -768,7 +768,7 @@ module.exports = C; exports[`test state.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); type State = { bar: ?{ qux: string; }; @@ -792,7 +792,7 @@ var ReactClass = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Any state access here seems to make state any -var React = require(\"react\"); +var React = require("react"); type State = { bar: ?{ qux: string } }; var ReactClass = React.createClass({ getInitialState: function(): State { @@ -813,7 +813,7 @@ var ReactClass = React.createClass({ exports[`test state2.js 1`] = ` "// @flow -var React = require(\'react\'); +var React = require('react'); type FooState = { key: ?Object; @@ -831,7 +831,7 @@ module.exports = Comp; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // this used to cause a missing annotation error -var React = require(\"react\"); +var React = require("react"); type FooState = { key: ?Object }; var Comp = React.createClass({ getInitialState: function(): FooState { @@ -843,12 +843,12 @@ module.exports = Comp; `; exports[`test state3.js 1`] = ` -"var React = require(\'react\'); +"var React = require('react'); var TestState = React.createClass({ getInitialState: function(): { x: string; } { return { - x: \'\' + x: '' } }, @@ -864,10 +864,10 @@ var TestState = React.createClass({ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error // error -var React = require(\"react\"); +var React = require("react"); var TestState = React.createClass({ getInitialState: function(): { x: string } { - return { x: \"\" }; + return { x: "" }; }, test: function() { var a: number = this.state.x; @@ -878,7 +878,7 @@ var TestState = React.createClass({ `; exports[`test state4.js 1`] = ` -"var React = require(\'React\'); +"var React = require('React'); var C = React.createClass({ getInitialState: function() { @@ -892,7 +892,7 @@ var C = React.createClass({ }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var React = require(\"React\"); +var React = require("React"); var C = React.createClass({ getInitialState: function() { return { x: 0 }; @@ -906,7 +906,7 @@ var C = React.createClass({ `; exports[`test state5.js 1`] = ` -"var React = require(\'React\'); +"var React = require('React'); class C extends React.Component { foo(): number { @@ -915,7 +915,7 @@ class C extends React.Component { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // error: need to declare type of state -var React = require(\"React\"); +var React = require("React"); class C extends React.Component { foo(): number { return this.state.x; diff --git a/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap index 35b84c3b9..d3605fe97 100644 --- a/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/assert/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test assert.js 1`] = ` "/* @flow */ -var assert = require(\"assert\") +var assert = require("assert") assert(true) // ok assert.ok(true) // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // ok // ok -var assert = require(\"assert\"); +var assert = require("assert"); assert(true); assert.ok(true); " diff --git a/tests/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap index a1a30411e..40e4aa87c 100644 --- a/tests/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/buffer/__snapshots__/jsfmt.spec.js.snap @@ -77,7 +77,7 @@ buffer.byteLength; buffer[1]; buffer.copyWithin(0, 0); buffer.copyWithin(0, 0, 0); -const it1: Iterator<[numbernumber]> = buffer.entries(); +const it1: Iterator<[number, number]> = buffer.entries(); bool = buffer.every((element: number) => false); bool = buffer.every((element: number) => false, buffer); buffer = buffer.fill(1); diff --git a/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap b/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap index 7b7760bad..b67ac591f 100644 --- a/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap +++ b/tests/node_tests/crypto/__snapshots__/jsfmt.spec.js.snap @@ -1,39 +1,39 @@ exports[`test crypto.js 1`] = ` "/* @flow */ -const crypto = require(\'crypto\'); +const crypto = require('crypto'); let tests = [ // Hmac is a duplex stream function() { - const hmac = crypto.createHmac(\'sha256\', \'a secret\'); + const hmac = crypto.createHmac('sha256', 'a secret'); - hmac.on(\'readable\', () => { + hmac.on('readable', () => { (hmac.read(): ?(string | Buffer)); (hmac.read(): number); // 4 errors: null, void, string, Buffer }); - hmac.write(\'some data to hash\'); + hmac.write('some data to hash'); hmac.write(123); // 2 errors: not a string or a Buffer hmac.end(); }, // Hmac supports update and digest functions too function(buf: Buffer) { - const hmac = crypto.createHmac(\'sha256\', \'a secret\'); + const hmac = crypto.createHmac('sha256', 'a secret'); - hmac.update(\'some data to hash\'); - hmac.update(\'foo\', \'utf8\'); - hmac.update(\'foo\', \'bogus\'); // 1 error + hmac.update('some data to hash'); + hmac.update('foo', 'utf8'); + hmac.update('foo', 'bogus'); // 1 error hmac.update(buf); - hmac.update(buf, \'utf8\'); // 1 error: no encoding when passing a buffer + hmac.update(buf, 'utf8'); // 1 error: no encoding when passing a buffer - // it\'s also chainable - (hmac.update(\'some data to hash\').update(buf).digest(): Buffer); + // it's also chainable + (hmac.update('some data to hash').update(buf).digest(): Buffer); - (hmac.digest(\'hex\'): string); + (hmac.digest('hex'): string); (hmac.digest(): Buffer); - (hmac.digest(\'hex\'): void); // 1 error + (hmac.digest('hex'): void); // 1 error (hmac.digest(): void); // 1 error } ] @@ -45,35 +45,35 @@ let tests = [ // Hmac supports update and digest functions too // 1 error // 1 error: no encoding when passing a buffer -// it\'s also chainable +// it's also chainable // 1 error // 1 error -const crypto = require(\"crypto\"); +const crypto = require("crypto"); let tests = [ function() { - const hmac = crypto.createHmac(\"sha256\", \"a secret\"); + const hmac = crypto.createHmac("sha256", "a secret"); hmac.on( - \"readable\", + "readable", () => { (hmac.read(): ?(string | Buffer)); (hmac.read(): number); } ); - hmac.write(\"some data to hash\"); + hmac.write("some data to hash"); hmac.write(123); hmac.end(); }, function(buf: Buffer) { - const hmac = crypto.createHmac(\"sha256\", \"a secret\"); - hmac.update(\"some data to hash\"); - hmac.update(\"foo\", \"utf8\"); - hmac.update(\"foo\", \"bogus\"); + const hmac = crypto.createHmac("sha256", "a secret"); + hmac.update("some data to hash"); + hmac.update("foo", "utf8"); + hmac.update("foo", "bogus"); hmac.update(buf); - hmac.update(buf, \"utf8\"); - (hmac.update(\"some data to hash\").update(buf).digest(): Buffer); - (hmac.digest(\"hex\"): string); + hmac.update(buf, "utf8"); + (hmac.update("some data to hash").update(buf).digest(): Buffer); + (hmac.digest("hex"): string); (hmac.digest(): Buffer); - (hmac.digest(\"hex\"): void); + (hmac.digest("hex"): void); (hmac.digest(): void); } ]; diff --git a/tests/nullable/__snapshots__/jsfmt.spec.js.snap b/tests/nullable/__snapshots__/jsfmt.spec.js.snap index c1a757cfd..3bd5fb13a 100644 --- a/tests/nullable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/nullable/__snapshots__/jsfmt.spec.js.snap @@ -2,14 +2,14 @@ exports[`test maybe.js 1`] = ` "// @flow // unwrapping nested maybes should work -((\'foo\': ?(?string)): ?string); // ok +(('foo': ?(?string)): ?string); // ok ((123: ?(?number)): ?string); // error (only num ~> string) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow // unwrapping nested maybes should work // ok // error (only num ~> string) -((\"foo\": ??string): ?string); +(("foo": ??string): ?string); ((123: ??number): ?string); " `; @@ -68,11 +68,11 @@ var array_of_nullable: Array = [ null, 3 ]; exports[`test simple_nullable.js 1`] = ` "function foo(x:?string) {} function bar(x:?number) {} -foo(\'hmm\'); -bar(\'hmm\'); +foo('hmm'); +bar('hmm'); function fn(data: ?{}) {} -fn({some: \'literal\'}); +fn({some: 'literal'}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: ?string) { @@ -80,11 +80,11 @@ function foo(x: ?string) { function bar(x: ?number) { } -foo(\"hmm\"); -bar(\"hmm\"); +foo("hmm"); +bar("hmm"); function fn(data: ?{}) { } -fn({ some: \"literal\" }); +fn({ some: "literal" }); " `; diff --git a/tests/object-method/__snapshots__/jsfmt.spec.js.snap b/tests/object-method/__snapshots__/jsfmt.spec.js.snap index e012ed646..6b3dc937b 100644 --- a/tests/object-method/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object-method/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test id.js 1`] = ` module.exports = id; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare function id(_: X): X; +declare function id(_: X): X; module.exports = id; " `; @@ -16,7 +16,7 @@ import type { ObjectType } from \'./test\'; function subtypeCheck(x: Interface): ObjectType { return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -interface Interface extends { m: : () => void } +interface Interface { m(): void } import type { ObjectType } from \"./test\"; function subtypeCheck(x: Interface): ObjectType { return x; @@ -40,7 +40,7 @@ module.exports = id( ); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ const id = require(\"./id\"); -export type ObjectType = { +m: : () => void }; +export type ObjectType = { +m: () => void }; function methodCaller(x: ObjectType) { x.m(); } @@ -114,7 +114,7 @@ function bar(f: () => void) { ({ f }).f(); } bar(foo); -function qux(o: { f: : () => void }) { +function qux(o: { f(): void }) { o.f(); } qux({ f: foo }); diff --git a/tests/object_api/__snapshots__/jsfmt.spec.js.snap b/tests/object_api/__snapshots__/jsfmt.spec.js.snap index fd63491ce..d227179d2 100644 --- a/tests/object_api/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_api/__snapshots__/jsfmt.spec.js.snap @@ -73,7 +73,7 @@ var export_ = Object.assign( } } ); -var decl_export_: { foo: any, bar: any } = Object.assign({}, export_); +var decl_export_: { foo: any; bar: any } = Object.assign({}, export_); let anyObj: Object = {}; Object.assign(anyObj, anyObj); module.exports = export_; diff --git a/tests/object_assign/__snapshots__/jsfmt.spec.js.snap b/tests/object_assign/__snapshots__/jsfmt.spec.js.snap index 96f0d7585..d1295a184 100644 --- a/tests/object_assign/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_assign/__snapshots__/jsfmt.spec.js.snap @@ -3,22 +3,22 @@ exports[`test A.js 1`] = ` * @flow */ -var EventEmitter = require(\'events\').EventEmitter; +var EventEmitter = require('events').EventEmitter; // This pattern seems to cause the trouble. var Bad = Object.assign({}, EventEmitter.prototype, { - foo: function(): string { return \'hi\'; } + foo: function(): string { return 'hi'; } }); -// Calling Bad.foo() in the same file doesn\'t error +// Calling Bad.foo() in the same file doesn't error var bad: number = Bad.foo(); -// Doesn\'t repro if I extend the class myself +// Doesn't repro if I extend the class myself class MyEventEmitter extends events$EventEmitter {} var Good = Object.assign({}, MyEventEmitter.prototype, { - foo: function(): string { return \'hi\'; } + foo: function(): string { return 'hi'; } }); -// Calling Good.foo() in the same file doesn\'t error +// Calling Good.foo() in the same file doesn't error var good: number = Good.foo(); module.exports = { @@ -30,16 +30,16 @@ module.exports = { * @flow */ // This pattern seems to cause the trouble. -// Calling Bad.foo() in the same file doesn\'t error -// Doesn\'t repro if I extend the class myself -// Calling Good.foo() in the same file doesn\'t error -var EventEmitter = require(\"events\").EventEmitter; +// Calling Bad.foo() in the same file doesn't error +// Doesn't repro if I extend the class myself +// Calling Good.foo() in the same file doesn't error +var EventEmitter = require("events").EventEmitter; var Bad = Object.assign( {}, EventEmitter.prototype, { foo: function(): string { - return \"hi\"; + return "hi"; } } ); @@ -50,7 +50,7 @@ var Good = Object.assign( MyEventEmitter.prototype, { foo: function(): string { - return \"hi\"; + return "hi"; } } ); @@ -64,7 +64,7 @@ exports[`test B.js 1`] = ` * @flow */ -var A = require(\'./A.js\'); +var A = require('./A.js'); var good: number = A.Good.foo(); @@ -89,7 +89,7 @@ B.js|12 col 1 error| call of method foo || Property not found in A.js|8 col 23 error| object literal */ -var A = require(\"./A.js\"); +var A = require("./A.js"); var good: number = A.Good.foo(); var f = A.Bad.foo; var bad_: number = f(); @@ -100,36 +100,36 @@ var bad: number = A.Bad.foo(); exports[`test apply.js 1`] = ` "// @flow -(Object.assign.apply(null, [{}, {a: 1}, {b: \'foo\'}]): {a: number, b: string}); -(Object.assign({}, ...[{a: 1}, {b: \'foo\'}]): {a: number, b: string}); +(Object.assign.apply(null, [{}, {a: 1}, {b: 'foo'}]): {a: number, b: string}); +(Object.assign({}, ...[{a: 1}, {b: 'foo'}]): {a: number, b: string}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -(Object.assign.apply(null, [ {}, { a: 1 }, { b: \"foo\" } ]): { - a: number, +(Object.assign.apply(null, [ {}, { a: 1 }, { b: "foo" } ]): { + a: number; b: string }); -(Object.assign({}, ...[ { a: 1 }, { b: \"foo\" } ]): { a: number, b: string }); +(Object.assign({}, ...[ { a: 1 }, { b: "foo" } ]): { a: number; b: string }); " `; exports[`test non_objects.js 1`] = ` "/* @flow */ -Object.assign(\"123\", {a: \"foo\"}); -Object.assign(123, {a: \"foo\"}); -Object.assign({a: \"foo\"}, 123); +Object.assign("123", {a: "foo"}); +Object.assign(123, {a: "foo"}); +Object.assign({a: "foo"}, 123); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -Object.assign(\"123\", { a: \"foo\" }); -Object.assign(123, { a: \"foo\" }); -Object.assign({ a: \"foo\" }, 123); +Object.assign("123", { a: "foo" }); +Object.assign(123, { a: "foo" }); +Object.assign({ a: "foo" }, 123); " `; exports[`test undefined.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); type DefaultProps = { foo: number, @@ -151,7 +151,7 @@ class MyReactThing extends React.Component { /* @flow */ /* works*/ // also works -var React = require(\"react\"); +var React = require("react"); type DefaultProps = { foo: number }; type Props = { foo: number }; class MyReactThing extends React.Component { diff --git a/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap b/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap index ded3b2c4b..5822aaa47 100644 --- a/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_freeze/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test object_freeze.js 1`] = ` "/* @flow */ -var foo = Object.freeze({bar: \'12345\'}); -foo.bar = \'23456\'; // error +var foo = Object.freeze({bar: '12345'}); +foo.bar = '23456'; // error -Object.assign(foo, {bar: \'12345\'}); // error +Object.assign(foo, {bar: '12345'}); // error var baz = {baz: 12345}; -var bliffl = Object.freeze({bar: \'12345\', ...baz}); -bliffl.bar = \'23456\'; // error +var bliffl = Object.freeze({bar: '12345', ...baz}); +bliffl.bar = '23456'; // error bliffl.baz = 3456; // error bliffl.corge; // error bliffl.constructor = baz; // error @@ -18,7 +18,7 @@ baz.baz = 0; var x : number = Object.freeze(123); -var xx : { x: number } = Object.freeze({ x: \"error\" }) +var xx : { x: number } = Object.freeze({ x: "error" }) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error @@ -28,12 +28,12 @@ var xx : { x: number } = Object.freeze({ x: \"error\" }) // error // error // error -var foo = Object.freeze({ bar: \"12345\" }); -foo.bar = \"23456\"; -Object.assign(foo, { bar: \"12345\" }); +var foo = Object.freeze({ bar: "12345" }); +foo.bar = "23456"; +Object.assign(foo, { bar: "12345" }); var baz = { baz: 12345 }; -var bliffl = Object.freeze({ bar: \"12345\", ...baz }); -bliffl.bar = \"23456\"; +var bliffl = Object.freeze({ bar: "12345", ...baz }); +bliffl.bar = "23456"; bliffl.baz = 3456; bliffl.corge; bliffl.constructor = baz; @@ -42,6 +42,6 @@ bliffl.toString = function() { }; baz.baz = 0; var x: number = Object.freeze(123); -var xx: { x: number } = Object.freeze({ x: \"error\" }); +var xx: { x: number } = Object.freeze({ x: "error" }); " `; diff --git a/tests/object_is/__snapshots__/jsfmt.spec.js.snap b/tests/object_is/__snapshots__/jsfmt.spec.js.snap index 8bc88aaa2..8c4883745 100644 --- a/tests/object_is/__snapshots__/jsfmt.spec.js.snap +++ b/tests/object_is/__snapshots__/jsfmt.spec.js.snap @@ -17,10 +17,10 @@ Object.is(emptyObject, emptyArray); var squared = x => x * x; Object.is(squared, squared); -var a: boolean = Object.is(\'a\', \'a\'); -var b: string = Object.is(\'a\', \'a\'); -var c: boolean = Object.is(\'a\'); -var d: boolean = Object.is(\'a\', \'b\', \'c\'); +var a: boolean = Object.is('a', 'a'); +var b: string = Object.is('a', 'a'); +var c: boolean = Object.is('a'); +var d: boolean = Object.is('a', 'b', 'c'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Object.is(1, 1); Object.is(1, 2); @@ -37,9 +37,9 @@ Object.is(emptyArray, emptyArray); Object.is(emptyObject, emptyArray); var squared = x => x * x; Object.is(squared, squared); -var a: boolean = Object.is(\"a\", \"a\"); -var b: string = Object.is(\"a\", \"a\"); -var c: boolean = Object.is(\"a\"); -var d: boolean = Object.is(\"a\", \"b\", \"c\"); +var a: boolean = Object.is("a", "a"); +var b: string = Object.is("a", "a"); +var c: boolean = Object.is("a"); +var d: boolean = Object.is("a", "b", "c"); " `; diff --git a/tests/objects/__snapshots__/jsfmt.spec.js.snap b/tests/objects/__snapshots__/jsfmt.spec.js.snap index bd87fb093..b6907d591 100644 --- a/tests/objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/objects/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test conversion.js 1`] = ` "/* @flow */ -(Object({foo: \'bar\'}): {foo: string}); -(Object(\"123\"): String); +(Object({foo: 'bar'}): {foo: string}); +(Object("123"): String); (Object(123): Number); (Object(true): Boolean); (Object(null): {}); @@ -11,9 +11,9 @@ exports[`test conversion.js 1`] = ` (Object(undefined): Number); // error var x = Object(null); -x.foo = \"bar\"; +x.foo = "bar"; -var y = Object(\"123\"); +var y = Object("123"); (y.charAt(0): string); var z = Object(123); // error (next line makes this not match any signatures) @@ -22,8 +22,8 @@ var z = Object(123); // error (next line makes this not match any signatures) /* @flow */ // error // error (next line makes this not match any signatures) -(Object({ foo: \"bar\" }): { foo: string }); -(Object(\"123\"): String); +(Object({ foo: "bar" }): { foo: string }); +(Object("123"): String); (Object(123): Number); (Object(true): Boolean); (Object(null): {}); @@ -31,8 +31,8 @@ var z = Object(123); // error (next line makes this not match any signatures) (Object(void 0): {}); (Object(undefined): Number); var x = Object(null); -x.foo = \"bar\"; -var y = Object(\"123\"); +x.foo = "bar"; +var y = Object("123"); (y.charAt(0): string); var z = Object(123); (z.charAt(0): string); @@ -42,50 +42,50 @@ var z = Object(123); exports[`test objects.js 1`] = ` "/* @flow */ -var x : {\'123\': string, bar: string} = {\'123\': \'val\', bar: \'bar\'}; -(x.foo : string); // error, key doesn\'t exist -(x[\'foo\'] : string); // error, key doesn\'t exist -(x[123] : boolean); // TODO: use the number\'s value to error here +var x : {'123': string, bar: string} = {'123': 'val', bar: 'bar'}; +(x.foo : string); // error, key doesn't exist +(x['foo'] : string); // error, key doesn't exist +(x[123] : boolean); // TODO: use the number's value to error here (x.bar: boolean); // error, string !~> boolean -(x[\'123\'] : boolean); // error, string !~> boolean -x[\'123\'] = false; // error, boolean !~> string -x[123] = false; // TODO: use the number\'s value to error here -x[\'foo\'+\'bar\'] = \'derp\'; // ok since we can\'t tell -(x[\`foo\`]: string); // error, key doesn\'t exist +(x['123'] : boolean); // error, string !~> boolean +x['123'] = false; // error, boolean !~> string +x[123] = false; // TODO: use the number's value to error here +x['foo'+'bar'] = 'derp'; // ok since we can't tell +(x[\`foo\`]: string); // error, key doesn't exist -var y : {foo: string} = {foo: \'bar\'}; -y[\'foo\'] = 123; // error, number !~> string -y[\'bar\'] = \'abc\'; // error, property not found +var y : {foo: string} = {foo: 'bar'}; +y['foo'] = 123; // error, number !~> string +y['bar'] = 'abc'; // error, property not found -(y[\'hasOwnProperty\']: string); // error, prototype method is not a string +(y['hasOwnProperty']: string); // error, prototype method is not a string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -// error, key doesn\'t exist -// error, key doesn\'t exist -// TODO: use the number\'s value to error here +// error, key doesn't exist +// error, key doesn't exist +// TODO: use the number's value to error here // error, string !~> boolean // error, string !~> boolean // error, boolean !~> string -// TODO: use the number\'s value to error here -// ok since we can\'t tell -// error, key doesn\'t exist +// TODO: use the number's value to error here +// ok since we can't tell +// error, key doesn't exist // error, number !~> string // error, property not found // error, prototype method is not a string -var x: { \"123\": string, bar: string } = { \"123\": \"val\", bar: \"bar\" }; +var x: { "123": string; bar: string } = { "123": "val", bar: "bar" }; (x.foo: string); -(x[\"foo\"]: string); +(x["foo"]: string); (x[123]: boolean); (x.bar: boolean); -(x[\"123\"]: boolean); -x[\"123\"] = false; +(x["123"]: boolean); +x["123"] = false; x[123] = false; -x[\"foo\" + \"bar\"] = \"derp\"; +x["foo" + "bar"] = "derp"; (x[\`foo\`]: string); -var y: { foo: string } = { foo: \"bar\" }; -y[\"foo\"] = 123; -y[\"bar\"] = \"abc\"; -(y[\"hasOwnProperty\"]: string); +var y: { foo: string } = { foo: "bar" }; +y["foo"] = 123; +y["bar"] = "abc"; +(y["hasOwnProperty"]: string); " `; @@ -94,7 +94,7 @@ exports[`test unaliased_assign.js 1`] = ` * test handling of unaliased value assignment. * * An unaliased object rvalue may be assigned to a supertype lvalue, - * because later widening mutations on the rvalue can\'t break assumptions + * because later widening mutations on the rvalue can't break assumptions * made by other lvalues. * * However, upon assignment the rvalue must take on the type of the @@ -104,25 +104,25 @@ exports[`test unaliased_assign.js 1`] = ` * @flow */ -var glob: { x: string } = { x: \"hey\" }; +var glob: { x: string } = { x: "hey" }; function assign_then_alias() { var obj: { x: string | number }; - obj = { x: \"hey\" }; + obj = { x: "hey" }; glob = obj; // error: subsequent assignment might make glob.x a number } function assign_then_widen() { var obj: { x: string | number }; - obj = { x: \"hey\" }; - obj.x = 10; // ok, by lvalue\'s given type + obj = { x: "hey" }; + obj.x = 10; // ok, by lvalue's given type } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * test handling of unaliased value assignment. * * An unaliased object rvalue may be assigned to a supertype lvalue, - * because later widening mutations on the rvalue can\'t break assumptions + * because later widening mutations on the rvalue can't break assumptions * made by other lvalues. * * However, upon assignment the rvalue must take on the type of the @@ -132,16 +132,16 @@ function assign_then_widen() { * @flow */ // error: subsequent assignment might make glob.x a number -// ok, by lvalue\'s given type -var glob: { x: string } = { x: \"hey\" }; +// ok, by lvalue's given type +var glob: { x: string } = { x: "hey" }; function assign_then_alias() { var obj: { x: string | number }; - obj = { x: \"hey\" }; + obj = { x: "hey" }; glob = obj; } function assign_then_widen() { var obj: { x: string | number }; - obj = { x: \"hey\" }; + obj = { x: "hey" }; obj.x = 10; } " diff --git a/tests/objmap/__snapshots__/jsfmt.spec.js.snap b/tests/objmap/__snapshots__/jsfmt.spec.js.snap index af5f52af2..fd2b47d75 100644 --- a/tests/objmap/__snapshots__/jsfmt.spec.js.snap +++ b/tests/objmap/__snapshots__/jsfmt.spec.js.snap @@ -22,8 +22,8 @@ promiseAllByKey({ // error, \'FOO\' incompatible with \'BAR\' // error, number ~> string // ok -declare function promiseAllByKey(o: O): Promise<$ObjMap>; -declare function keyMirror(o: O): $ObjMapi K>; +declare function promiseAllByKey(o: O): Promise<$ObjMap>; +declare function keyMirror(o: O): $ObjMapi(k: K) => K>; var o = keyMirror({ FOO: null, BAR: null }); (o.FOO: \"FOO\"); (o.FOO: \"BAR\"); diff --git a/tests/optional/__snapshots__/jsfmt.spec.js.snap b/tests/optional/__snapshots__/jsfmt.spec.js.snap index e22684a72..519ea3610 100644 --- a/tests/optional/__snapshots__/jsfmt.spec.js.snap +++ b/tests/optional/__snapshots__/jsfmt.spec.js.snap @@ -13,7 +13,7 @@ exports[`test default.js 1`] = ` return [foo, bar]; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function f(foo, bar = foo): [TT] { +function f(foo, bar = foo): [T, T] { return [ foo, bar ]; } " @@ -42,7 +42,7 @@ exports[`test maybe.js 1`] = ` return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function foo(x: string): ?string { +function foo(x?: string): ?string { return x; } " @@ -161,7 +161,7 @@ qux(0,...[\"\",42]); module.exports = qux; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function bar(x, y) { +function bar(x?, y?) { x * 0; } bar(0); @@ -215,7 +215,7 @@ function testOptionalNullableFlowingToNullable(x?: ?string): ?string { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -function foo(x: string): string { +function foo(x?: string): string { if (x == null) { return \"foo\"; } @@ -227,19 +227,19 @@ function bar(obj: { x?: string }): string { } return obj.x; } -function baz(bar) { +function baz(bar?) { if (!bar) { return 1; } return bar.duck; } -function testOptionalNullable(x: ?string): string { +function testOptionalNullable(x?: ?string): string { if (x == null) { return \"foo\"; } return x; } -function testOptionalNullableDefault(x: ?string = \"hi\"): string { +function testOptionalNullableDefault(x?: ?string = \"hi\"): string { if (x == null) { return \"foo\"; } @@ -251,7 +251,7 @@ function testOptionalNullableProperty(obj: { x?: ?string }): string { } return obj.x; } -function testOptionalNullableFlowingToNullable(x: ?string): ?string { +function testOptionalNullableFlowingToNullable(x?: ?string): ?string { var f = function(y: ?string) { }; @@ -269,7 +269,7 @@ exports[`test optional_param2.js 1`] = ` var i:I = new I(); var j:I = i.map(id => id); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare class I { map: : (mapper: (value?: V) => M) => I } +declare class I { map(mapper: (value?: V) => M): I } var i: I = new I(); var j: I = i.map(id => id); " @@ -286,7 +286,7 @@ bar(undefined); // ok ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ok // ok -function foo(x: number) { +function foo(x?: number) { } foo(undefined); @@ -318,7 +318,7 @@ foo(123, true); // ERROR boolean ~> string // OK // ERROR boolean ~> number // ERROR boolean ~> string -function foo(x: number, ...y: Array): [?numberArray] { +function foo(x?: number, ...y: Array): [?number, Array] { return [ x, y ]; } foo(); @@ -340,7 +340,7 @@ function bar() { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x; -function foo(bar = undefined) { +function foo(bar? = undefined) { x = bar; } function bar() { @@ -361,7 +361,7 @@ function bar() { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x; -function foo(bar) { +function foo(bar?) { x = bar; } function bar() { diff --git a/tests/optional_props/__snapshots__/jsfmt.spec.js.snap b/tests/optional_props/__snapshots__/jsfmt.spec.js.snap index c41a67a40..d06ac7928 100644 --- a/tests/optional_props/__snapshots__/jsfmt.spec.js.snap +++ b/tests/optional_props/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test test.js 1`] = ` "var x: { } = { foo: 0 }; var y: { foo?: string } = x; // OK in TypeScript, not OK in Flow -var z: string = y.foo || \"\"; +var z: string = y.foo || ""; var o = { }; y = o; // OK; we know that narrowing could not have happened @@ -10,14 +10,14 @@ o.foo = 0; // future widening is constrained function bar(config: { foo?: number }) {} bar({}); -bar({foo: \"\"}); +bar({foo: ""}); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // OK in TypeScript, not OK in Flow // OK; we know that narrowing could not have happened // future widening is constrained var x: {} = { foo: 0 }; var y: { foo?: string } = x; -var z: string = y.foo || \"\"; +var z: string = y.foo || ""; var o = {}; y = o; o.foo = 0; @@ -25,7 +25,7 @@ function bar(config: { foo?: number }) { } bar({}); -bar({ foo: \"\" }); +bar({ foo: "" }); " `; @@ -70,7 +70,7 @@ exports[`test test3.js 1`] = ` /* object literals are sealed. this is simply a heuristic - decision: most of the time, the rule gives the \'right\' + decision: most of the time, the rule gives the 'right' errors. an exception is when a literal is used as an initializer @@ -79,7 +79,7 @@ exports[`test test3.js 1`] = ` the problem becomes visible when a property assignment is then used to (legitimately) extend the object with an - optional property - the variable\'s specific (path- + optional property - the variable's specific (path- dependent) type has become that of the literal which. without adjustment, will reject the property addition. @@ -91,15 +91,15 @@ exports[`test test3.js 1`] = ` // x has optional property b. // (note that the initializer here does not play into -// the problem, it\'s just a placeholder. initializers +// the problem, it's just a placeholder. initializers // do not narrow the types of annotated variables as do // subsequent assignments.) // var x: { a: number, b?: number } = { a: 0 }; // now assign an object literal lacking property b. -// the literal\'s type is sealed and has only a at creation. -// but it then flows, specific ~> general, to x\'s annotation +// the literal's type is sealed and has only a at creation. +// but it then flows, specific ~> general, to x's annotation // type. at that point, it acquires b as an optional property. // x = { a: 0 }; @@ -111,7 +111,7 @@ x.b = 1; class A { x: { a: number, b?: string }; foo() { - // Something similar should happen here, but doesn\'t: the problem is + // Something similar should happen here, but doesn't: the problem is // made explicit by adding generics (see test3_failure.js introduced by // D2747512). There is a race between writing b on the object literal // type and adding b as an optional property to it, since in general we @@ -119,14 +119,14 @@ class A { // annotation will be processed before the flow involving the // access. Here we lose the race and get an error on the write. this.x = { a: 123 }; - this.x.b = \'hello\'; + this.x.b = 'hello'; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow /* object literals are sealed. this is simply a heuristic - decision: most of the time, the rule gives the \'right\' + decision: most of the time, the rule gives the 'right' errors. an exception is when a literal is used as an initializer @@ -135,7 +135,7 @@ class A { the problem becomes visible when a property assignment is then used to (legitimately) extend the object with an - optional property - the variable\'s specific (path- + optional property - the variable's specific (path- dependent) type has become that of the literal which. without adjustment, will reject the property addition. @@ -146,32 +146,32 @@ class A { */ // x has optional property b. // (note that the initializer here does not play into -// the problem, it\'s just a placeholder. initializers +// the problem, it's just a placeholder. initializers // do not narrow the types of annotated variables as do // subsequent assignments.) // // now assign an object literal lacking property b. -// the literal\'s type is sealed and has only a at creation. -// but it then flows, specific ~> general, to x\'s annotation +// the literal's type is sealed and has only a at creation. +// but it then flows, specific ~> general, to x's annotation // type. at that point, it acquires b as an optional property. // // ...which allows this assignment to take place. // T7810506 -// Something similar should happen here, but doesn\'t: the problem is +// Something similar should happen here, but doesn't: the problem is // made explicit by adding generics (see test3_failure.js introduced by // D2747512). There is a race between writing b on the object literal // type and adding b as an optional property to it, since in general we // cannot guarantee that the flow from the object literal to the // annotation will be processed before the flow involving the // access. Here we lose the race and get an error on the write. -var x: { a: number, b?: number } = { a: 0 }; +var x: { a: number; b?: number } = { a: 0 }; x = { a: 0 }; x.b = 1; class A { - x: { a: number, b?: string }; + x: { a: number; b?: string }; foo() { this.x = { a: 123 }; - this.x.b = \"hello\"; + this.x.b = "hello"; } } " @@ -184,17 +184,17 @@ class A { o: O; foo() { this.o.x = { a: 123 }; - this.o.x.b = \'hello\'; // this is a spurious error (see test3.js for details) + this.o.x.b = 'hello'; // this is a spurious error (see test3.js for details) } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // generalization of failure in test3.js // this is a spurious error (see test3.js for details) -class A { +class A { o: O; foo() { this.o.x = { a: 123 }; - this.o.x.b = \"hello\"; + this.o.x.b = "hello"; } } " diff --git a/tests/overload/__snapshots__/jsfmt.spec.js.snap b/tests/overload/__snapshots__/jsfmt.spec.js.snap index 6dedb8f5a..16b0fd7cf 100644 --- a/tests/overload/__snapshots__/jsfmt.spec.js.snap +++ b/tests/overload/__snapshots__/jsfmt.spec.js.snap @@ -5,10 +5,10 @@ exports[`test overload.js 1`] = ` * @flow */ -var x1: number = \"\".match(0)[0]; -var x2: number = \"\".match(/pattern/)[0]; -var x3: string = \"\".replace(/pattern/,\"...\"); -var x4: number = \"\".split(/pattern/)[0]; +var x1: number = "".match(0)[0]; +var x2: number = "".match(/pattern/)[0]; +var x3: string = "".replace(/pattern/,"..."); +var x4: number = "".split(/pattern/)[0]; declare class C { foo(x:number): number; @@ -21,11 +21,11 @@ declare class C { var a = new C(); a.foo(0); // ok -a.foo(\"hey\"); // ok +a.foo("hey"); // ok a.foo(true); // error, function cannot be called on intersection type a.bar({ a: 0 }); // ok -a.bar({ a: \"hey\" }); // ok +a.bar({ a: "hey" }); // ok a.bar({ a: true }); // error, function cannot be called on intersection type declare var x: { a: boolean; } & { b: string }; @@ -47,7 +47,7 @@ var y:number = new Dummy().dumb(foo); function bar1(x:number):Array { return []; } var z1:number = new Dummy().dumber(bar1); -function bar2(x:number):string { return \"...\"; } +function bar2(x:number):string { return "..."; } var z2:Array = new Dummy().dumber(bar2); */ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -78,25 +78,25 @@ var y:number = new Dummy().dumb(foo); function bar1(x:number):Array { return []; } var z1:number = new Dummy().dumber(bar1); -function bar2(x:number):string { return \"...\"; } +function bar2(x:number):string { return "..."; } var z2:Array = new Dummy().dumber(bar2); */ -var x1: number = \"\".match(0)[0]; -var x2: number = \"\".match(/pattern/)[0]; -var x3: string = \"\".replace(/pattern/, \"...\"); -var x4: number = \"\".split(/pattern/)[0]; +var x1: number = "".match(0)[0]; +var x2: number = "".match(/pattern/)[0]; +var x3: string = "".replace(/pattern/, "..."); +var x4: number = "".split(/pattern/)[0]; declare class C { - foo: : (x: number) => number, - foo: : (x: string) => string, - bar: : (x: { a: number }) => number, - bar: : (x: { a: string }) => string + foo(x: number): number; + foo(x: string): string; + bar(x: { a: number }): number; + bar(x: { a: string }): string } var a = new C(); a.foo(0); -a.foo(\"hey\"); +a.foo("hey"); a.foo(true); a.bar({ a: 0 }); -a.bar({ a: \"hey\" }); +a.bar({ a: "hey" }); a.bar({ a: true }); declare var x: { a: boolean } & { b: string }; a.bar(x); @@ -119,19 +119,19 @@ function foo() { exports[`test test2.js 1`] = ` "declare class Foo { - bar(x: \'hmm\'): number; + bar(x: 'hmm'): number; bar(x: string): string; } var foo = new Foo; -(foo.bar(\'hmm\'): number); // OK -(foo.bar(\'hmmm\'): number); // error +(foo.bar('hmm'): number); // OK +(foo.bar('hmmm'): number); // error ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // OK // error -declare class Foo { bar: : (x: \"hmm\") => number, bar: : (x: string) => string } +declare class Foo { bar(x: "hmm"): number; bar(x: string): string } var foo = new Foo(); -(foo.bar(\"hmm\"): number); -(foo.bar(\"hmmm\"): number); +(foo.bar("hmm"): number); +(foo.bar("hmmm"): number); " `; @@ -186,12 +186,12 @@ exports[`test union.js 1`] = ` "function foo (x: $Either,U>): Array { return []; } var x1:number = foo(0)[0]; -var x2:string = foo([\"\"])[0]; +var x2:string = foo([""])[0]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x: $Either, U>): Array { return [ ]; } var x1: number = foo(0)[0]; -var x2: string = foo([ \"\" ])[0]; +var x2: string = foo([ "" ])[0]; " `; diff --git a/tests/overload/lib/__snapshots__/jsfmt.spec.js.snap b/tests/overload/lib/__snapshots__/jsfmt.spec.js.snap index c52a7eaf8..9089ba47e 100644 --- a/tests/overload/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/overload/lib/__snapshots__/jsfmt.spec.js.snap @@ -5,8 +5,8 @@ exports[`test lib.js 1`] = ` } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare class FakeUint8Array { - set: : (index: number, value: number) => void, - set: : (array: FakeUint8Array | Array, offset?: number) => void + set(index: number, value: number): void; + set(array: FakeUint8Array | Array, offset?: number): void } " `; diff --git a/tests/parse/__snapshots__/jsfmt.spec.js.snap b/tests/parse/__snapshots__/jsfmt.spec.js.snap index 2203e5f5d..3d1664428 100644 --- a/tests/parse/__snapshots__/jsfmt.spec.js.snap +++ b/tests/parse/__snapshots__/jsfmt.spec.js.snap @@ -1,32 +1,3 @@ -exports[`test fail.js 1`] = ` -". -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -" -`; - -exports[`test fail-flow.js 1`] = ` -"/* @flow */ - -. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ - -" -`; - -exports[`test fail-flow-2.js 1`] = ` -"/** - * @flow */ - -. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * @flow */ - -" -`; - exports[`test no_parse_error.js 1`] = ` "/* @flow @@ -45,6 +16,6 @@ var z: { */ var x = \"Test\"; var y = 5 / x; -var z: { type: number, y: string } = { type: 1, y: \"hey\" }; +var z: { type: number; y: string } = { type: 1, y: \"hey\" }; " `; diff --git a/tests/parse/fail-flow-2.js b/tests/parse/fail-flow-2.js deleted file mode 100644 index 97dfd87f7..000000000 --- a/tests/parse/fail-flow-2.js +++ /dev/null @@ -1,4 +0,0 @@ -/** - * @flow */ - -. diff --git a/tests/parse/fail-flow.js b/tests/parse/fail-flow.js deleted file mode 100644 index 762b3652b..000000000 --- a/tests/parse/fail-flow.js +++ /dev/null @@ -1,3 +0,0 @@ -/* @flow */ - -. diff --git a/tests/parse/fail.js b/tests/parse/fail.js deleted file mode 100644 index 9c558e357..000000000 --- a/tests/parse/fail.js +++ /dev/null @@ -1 +0,0 @@ -. diff --git a/tests/parse_error_haste/NoProvides.js b/tests/parse_error_haste/NoProvides.js deleted file mode 100644 index 16817984e..000000000 --- a/tests/parse_error_haste/NoProvides.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Parse errors, imported, not in flow, no provides module. - * No parse errors are raised because it is ignored by flow. - */ -function f(s) { ### // illegal token - return s; -} - -module.exports = { f: f } diff --git a/tests/parse_error_haste/ParseError.js b/tests/parse_error_haste/ParseError.js deleted file mode 100644 index 6766fa50e..000000000 --- a/tests/parse_error_haste/ParseError.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow - -function foo() { ### // invalid token -} - -module.exports = foo; diff --git a/tests/parse_error_haste/Provides.js b/tests/parse_error_haste/Provides.js deleted file mode 100644 index da8e04dca..000000000 --- a/tests/parse_error_haste/Provides.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Parse errors, imported, not in flow, provides module. - * Should see a parse error in this file, and module - * not found in client. - * @providesModule Foo - * @noflow - */ -function f(s: string): string { ### // illegal token - return s; -} - -module.exports = { f: f } diff --git a/tests/parse_error_haste/Unimported.js b/tests/parse_error_haste/Unimported.js deleted file mode 100644 index 177d59e6a..000000000 --- a/tests/parse_error_haste/Unimported.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Parse errors but not in flow and not imported. - * Should see no parse errors for this file. - * @providesModule Bar - */ -function f(s:string):string { ### // illegal token - return s; -} - -module.exports = { f: f } diff --git a/tests/parse_error_haste/__snapshots__/jsfmt.spec.js.snap b/tests/parse_error_haste/__snapshots__/jsfmt.spec.js.snap index 24dd0bddf..474ed9f42 100644 --- a/tests/parse_error_haste/__snapshots__/jsfmt.spec.js.snap +++ b/tests/parse_error_haste/__snapshots__/jsfmt.spec.js.snap @@ -25,108 +25,3 @@ var B = require(\"./NoProvides\"); var C = require(\"./ParseError\"); " `; - -exports[`test NoProvides.js 1`] = ` -"/** - * Parse errors, imported, not in flow, no provides module. - * No parse errors are raised because it is ignored by flow. - */ -function f(s) { ### // illegal token - return s; -} - -module.exports = { f: f } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * Parse errors, imported, not in flow, no provides module. - * No parse errors are raised because it is ignored by flow. - */ -// illegal token -function f(s) { - null; - null; - null; - return s; -} -module.exports = { f: f }; -" -`; - -exports[`test ParseError.js 1`] = ` -"// @flow - -function foo() { ### // invalid token -} - -module.exports = foo; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -// invalid token -function foo() { - null; - null; - null; -} -module.exports = foo; -" -`; - -exports[`test Provides.js 1`] = ` -"/** - * Parse errors, imported, not in flow, provides module. - * Should see a parse error in this file, and module - * not found in client. - * @providesModule Foo - * @noflow - */ -function f(s: string): string { ### // illegal token - return s; -} - -module.exports = { f: f } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * Parse errors, imported, not in flow, provides module. - * Should see a parse error in this file, and module - * not found in client. - * @providesModule Foo - * @noflow - */ -// illegal token -function f(s: string): string { - null; - null; - null; - return s; -} -module.exports = { f: f }; -" -`; - -exports[`test Unimported.js 1`] = ` -"/** - * Parse errors but not in flow and not imported. - * Should see no parse errors for this file. - * @providesModule Bar - */ -function f(s:string):string { ### // illegal token - return s; -} - -module.exports = { f: f } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * Parse errors but not in flow and not imported. - * Should see no parse errors for this file. - * @providesModule Bar - */ -// illegal token -function f(s: string): string { - null; - null; - null; - return s; -} -module.exports = { f: f }; -" -`; diff --git a/tests/parse_error_node/Imported.js b/tests/parse_error_node/Imported.js deleted file mode 100644 index 16817984e..000000000 --- a/tests/parse_error_node/Imported.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Parse errors, imported, not in flow, no provides module. - * No parse errors are raised because it is ignored by flow. - */ -function f(s) { ### // illegal token - return s; -} - -module.exports = { f: f } diff --git a/tests/parse_error_node/ParseError.js b/tests/parse_error_node/ParseError.js deleted file mode 100644 index 6766fa50e..000000000 --- a/tests/parse_error_node/ParseError.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow - -function foo() { ### // invalid token -} - -module.exports = foo; diff --git a/tests/parse_error_node/Unimported.js b/tests/parse_error_node/Unimported.js deleted file mode 100644 index 177d59e6a..000000000 --- a/tests/parse_error_node/Unimported.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Parse errors but not in flow and not imported. - * Should see no parse errors for this file. - * @providesModule Bar - */ -function f(s:string):string { ### // illegal token - return s; -} - -module.exports = { f: f } diff --git a/tests/parse_error_node/__snapshots__/jsfmt.spec.js.snap b/tests/parse_error_node/__snapshots__/jsfmt.spec.js.snap index 11f2e9136..19208f23c 100644 --- a/tests/parse_error_node/__snapshots__/jsfmt.spec.js.snap +++ b/tests/parse_error_node/__snapshots__/jsfmt.spec.js.snap @@ -22,76 +22,3 @@ var A = require(\"./Imported\"); var B = require(\"./ParseError\"); " `; - -exports[`test Imported.js 1`] = ` -"/** - * Parse errors, imported, not in flow, no provides module. - * No parse errors are raised because it is ignored by flow. - */ -function f(s) { ### // illegal token - return s; -} - -module.exports = { f: f } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * Parse errors, imported, not in flow, no provides module. - * No parse errors are raised because it is ignored by flow. - */ -// illegal token -function f(s) { - null; - null; - null; - return s; -} -module.exports = { f: f }; -" -`; - -exports[`test ParseError.js 1`] = ` -"// @flow - -function foo() { ### // invalid token -} - -module.exports = foo; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// @flow -// invalid token -function foo() { - null; - null; - null; -} -module.exports = foo; -" -`; - -exports[`test Unimported.js 1`] = ` -"/** - * Parse errors but not in flow and not imported. - * Should see no parse errors for this file. - * @providesModule Bar - */ -function f(s:string):string { ### // illegal token - return s; -} - -module.exports = { f: f } -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/** - * Parse errors but not in flow and not imported. - * Should see no parse errors for this file. - * @providesModule Bar - */ -// illegal token -function f(s: string): string { - null; - null; - null; - return s; -} -module.exports = { f: f }; -" -`; diff --git a/tests/path/__snapshots__/jsfmt.spec.js.snap b/tests/path/__snapshots__/jsfmt.spec.js.snap index 2de635b6a..d933c3022 100644 --- a/tests/path/__snapshots__/jsfmt.spec.js.snap +++ b/tests/path/__snapshots__/jsfmt.spec.js.snap @@ -1,16 +1,16 @@ exports[`test while.js 1`] = ` "var x = 1; -while(typeof x == \"number\" || typeof x == \"string\") { +while(typeof x == "number" || typeof x == "string") { x = x + 1; - if (true) x = \"\"; + if (true) x = ""; } var z:number = x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var x = 1; -while (typeof x == \"number\" || typeof x == \"string\") { +while (typeof x == "number" || typeof x == "string") { x = x + 1; if (true) - x = \"\"; + x = ""; } var z: number = x; " diff --git a/tests/plsummit/__snapshots__/jsfmt.spec.js.snap b/tests/plsummit/__snapshots__/jsfmt.spec.js.snap index a20611cb9..aca8305ec 100644 --- a/tests/plsummit/__snapshots__/jsfmt.spec.js.snap +++ b/tests/plsummit/__snapshots__/jsfmt.spec.js.snap @@ -1,11 +1,11 @@ exports[`test arrays.js 1`] = ` -"function foo(x) { return [x, x > 0, \"number \" + x]; } +"function foo(x) { return [x, x > 0, "number " + x]; } var [n, b, s] = foo(42); n * s.length; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function foo(x) { - return [ x, x > 0, \"number \" + x ]; + return [ x, x > 0, "number " + x ]; } var [ n, b, s ] = foo(42); n * s.length; @@ -46,12 +46,12 @@ function foo(x: X): X { `; exports[`test import_class.js 1`] = ` -"var C = require(\'./export_class\'); +"var C = require('./export_class'); -var c = new C(\"\"); +var c = new C(""); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var C = require(\"./export_class\"); -var c = new C(\"\"); +var C = require("./export_class"); +var c = new C(""); " `; @@ -64,7 +64,7 @@ function foo() { } function bar(x: ?string): number { - if (x == null) x = \"\"; + if (x == null) x = ""; return x.length; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -75,7 +75,7 @@ function foo() { } function bar(x: ?string): number { if (x == null) - x = \"\"; + x = ""; return x.length; } " @@ -90,7 +90,7 @@ var x: string = c.foo(); function foo() { return this.y; } function bar() { return this.foo(); } -var o = { y: \"\", foo: foo, bar: bar }; +var o = { y: "", foo: foo, bar: bar }; var o2 = { y: 0, foo: foo, bar: bar }; o.bar(); @@ -110,7 +110,7 @@ function foo() { function bar() { return this.foo(); } -var o = { y: \"\", foo: foo, bar: bar }; +var o = { y: "", foo: foo, bar: bar }; var o2 = { y: 0, foo: foo, bar: bar }; o.bar(); var y: number = o2.bar(); diff --git a/tests/poly/__snapshots__/jsfmt.spec.js.snap b/tests/poly/__snapshots__/jsfmt.spec.js.snap index 292992bc5..16a4986a2 100644 --- a/tests/poly/__snapshots__/jsfmt.spec.js.snap +++ b/tests/poly/__snapshots__/jsfmt.spec.js.snap @@ -94,14 +94,14 @@ unbox(bool); // naive unification causes combinatorial explosion here, // effectively hangs type Box = { - map1: : (f: (x: T) => U) => Box, - map2: : (f: (x: T) => U) => Box, - map3: : (f: (x: T) => U) => Box, - map4: : (f: (x: T) => U) => Box, - map5: : (f: (x: T) => U) => Box + map1(f: (x: T) => U): Box; + map2(f: (x: T) => U): Box; + map3(f: (x: T) => U): Box; + map4(f: (x: T) => U): Box; + map5(f: (x: T) => U): Box }; declare var bool: Box; -declare function unbox(box: Box): A; +declare function unbox(box: Box): A; unbox(bool); " `; @@ -136,7 +136,7 @@ function bar(foo: Foo, y: S): Foo { return new Foo(y); } var P = { bar: bar }; -declare var Q: { bar: : (foo: Foo, y: S) => Foo }; +declare var Q: { bar(foo: Foo, y: S): Foo }; var foo = new Foo(0); var x: string = foo.x; var z: Foo = Q.bar(foo, \"\"); diff --git a/tests/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap b/tests/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap index 293333d6f..56c694ed5 100644 --- a/tests/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap +++ b/tests/poly_overload/decls/__snapshots__/jsfmt.spec.js.snap @@ -16,21 +16,21 @@ interface B extends A { foo(s: Other, e: Nada): B; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -interface Some extends {} -interface Other extends { x: X } -interface None extends {} -interface Nada extends { y: Y } -interface A extends { - foo: : (s: Some, e: None) => A, - foo: : (s: Some, e: Nada) => A, - foo: : (s: Other, e: None) => A, - foo: : (s: Other, e: Nada) => A +interface Some {} +interface Other { x: X } +interface None {} +interface Nada { y: Y } +interface A { + foo(s: Some, e: None): A; + foo(s: Some, e: Nada): A; + foo(s: Other, e: None): A; + foo(s: Other, e: Nada): A } interface B extends A { - foo: : (s: Some, e: None) => B, - foo: : (s: Some, e: Nada) => B, - foo: : (s: Other, e: None) => B, - foo: : (s: Other, e: Nada) => B + foo(s: Some, e: None): B; + foo(s: Some, e: Nada): B; + foo(s: Other, e: None): B; + foo(s: Other, e: Nada): B } " `; diff --git a/tests/predicates-abstract/__snapshots__/jsfmt.spec.js.snap b/tests/predicates-abstract/__snapshots__/jsfmt.spec.js.snap index 0af8a93c6..40c563cc5 100644 --- a/tests/predicates-abstract/__snapshots__/jsfmt.spec.js.snap +++ b/tests/predicates-abstract/__snapshots__/jsfmt.spec.js.snap @@ -10,24 +10,19 @@ const barr = my_filter(arr, is_string); (barr: Array); function is_string(x): %checks { - return typeof x === "string"; + return typeof x === \"string\"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (11:23) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Filter the contents of an array +declare function my_filter>(v: Array, +cb: P): Array<$Refine>; +declare var arr: Array; +const barr = my_filter(arr, is_string); +(barr: Array); +function is_string(x): %checks { + return typeof x === \"string\"; +} " `; @@ -39,32 +34,31 @@ exports[`test filter-union.js 1`] = ` declare function my_filter>(v: Array, cb: P): Array<$Refine>; -type A = { kind: 'A', u: number } -type B = { kind: 'B', v: string } -type C = { kind: 'C', y: boolean } -type D = { kind: 'D', x: boolean } -type E = { kind: 'E', y: boolean } +type A = { kind: \'A\', u: number } +type B = { kind: \'B\', v: string } +type C = { kind: \'C\', y: boolean } +type D = { kind: \'D\', x: boolean } +type E = { kind: \'E\', y: boolean } declare var ab: Array; -(my_filter(ab, (x): %checks => x.kind === 'A'): Array); // OK -(my_filter(ab, (x): %checks => x.kind !== 'A'): Array); // OK +(my_filter(ab, (x): %checks => x.kind === \'A\'): Array); // OK +(my_filter(ab, (x): %checks => x.kind !== \'A\'): Array); // OK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (16:20) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Filter the contents of an array +// OK +// OK +declare function my_filter>(v: Array, +cb: P): Array<$Refine>; +type A = { kind: \"A\"; u: number }; +type B = { kind: \"B\"; v: string }; +type C = { kind: \"C\"; y: boolean }; +type D = { kind: \"D\"; x: boolean }; +type E = { kind: \"E\"; y: boolean }; +declare var ab: Array; +(my_filter(ab, x => x.kind === \"A\"): Array); +(my_filter(ab, x => x.kind !== \"A\"): Array); " `; @@ -72,7 +66,7 @@ exports[`test refine.js 1`] = ` "// @flow /* - $Pred is an "abstract predicate type", i.e. denotes a (function) type that + $Pred is an \"abstract predicate type\", i.e. denotes a (function) type that refines N variables. So if \`cb\` is a function, then it should be refining exactly N argument. It is abstract in that we do not need to specify: (a) which variables are going to be refined (just the number), or (b) what @@ -109,28 +103,51 @@ declare function refine2>(v: T, w: T, cb: P): $Refine; // { if (cb(v, w)) { return w; } else { throw new Error(); } } function is_string(x): boolean %checks { - return typeof x === "string"; + return typeof x === \"string\"; } function is_string_and_number(x, y): %checks { - return typeof x === "string" && typeof y === "number"; + return typeof x === \"string\" && typeof y === \"number\"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ +// @flow +/* + $Pred is an \"abstract predicate type\", i.e. denotes a (function) type that + refines N variables. So if \`cb\` is a function, then it should be refining + exactly N argument. It is abstract in that we do not need to specify: + (a) which variables are going to be refined (just the number), or (b) what + exactly the refinement (predicate) is going to be. -SyntaxError: Unexpected token, expected { (40:31) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.expect (/node_modules/babylon/lib/index.js:1621:33) - at Parser.pp$1.parseBlock (/node_modules/babylon/lib/index.js:2119:8) - at Parser.pp$3.parseFunctionBody (/node_modules/babylon/lib/index.js:4004:22) - at Parser.parseFunctionBody (/node_modules/babylon/lib/index.js:5211:20) - at Parser.pp$1.parseFunction (/node_modules/babylon/lib/index.js:2257:8) - at Parser.pp$1.parseFunctionStatement (/node_modules/babylon/lib/index.js:1926:15) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1712:19) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) + $Refine is a refinement type, that refines type T with the k-th + argument that gets refined by an abstract preficate type P. +*/ +// function refine(v, cb) +// { if (cb(v)) { return v; } else { throw new Error(); } } +/* + Use case +*/ +// function refine_fst(v, w, cb) +// { if (cb(v, w)) { return v; } else { throw new Error(); } } +// function refine_fst(v, w, cb) +// { if (cb(v, w)) { return w; } else { throw new Error(); } } +declare function refine>(v: T, cb: P): $Refine; +declare var a: mixed; +var b = refine(a, is_string); +(b: string); +declare function refine_fst>(v: T, +w: T, +cb: P): $Refine; +declare var c: mixed; +declare var d: mixed; +var e = refine2(c, d, is_string_and_number); +(e: string); +declare function refine2>(v: T, w: T, cb: P): $Refine; +function is_string(x): boolean: %checks { + return typeof x === \"string\"; +} +function is_string_and_number(x, y): %checks { + return typeof x === \"string\" && typeof y === \"number\"; +} " `; @@ -151,28 +168,30 @@ const d = my_filter(c, is_string_regular); (d: Array); function is_string(x): boolean %checks { - return typeof x === "string"; + return typeof x === \"string\"; } function is_string_regular(x): boolean { - return typeof x === "string"; + return typeof x === \"string\"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected { (16:31) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.expect (/node_modules/babylon/lib/index.js:1621:33) - at Parser.pp$1.parseBlock (/node_modules/babylon/lib/index.js:2119:8) - at Parser.pp$3.parseFunctionBody (/node_modules/babylon/lib/index.js:4004:22) - at Parser.parseFunctionBody (/node_modules/babylon/lib/index.js:5211:20) - at Parser.pp$1.parseFunction (/node_modules/babylon/lib/index.js:2257:8) - at Parser.pp$1.parseFunctionStatement (/node_modules/babylon/lib/index.js:1926:15) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1712:19) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) +// @flow +// Sanity check A: filtering the wrong type +// Sanity check B: Passing non-predicate function to filter +declare function my_filter>(v: Array, +cb: P): Array<$Refine>; +declare var a: Array; +const b = my_filter(a, is_string); +(b: Array); +declare var c: Array; +const d = my_filter(c, is_string_regular); +(d: Array); +function is_string(x): boolean: %checks { + return typeof x === \"string\"; +} +function is_string_regular(x): boolean { + return typeof x === \"string\"; +} " `; @@ -184,32 +203,31 @@ exports[`test sanity-filter-union.js 1`] = ` declare function my_filter>(v: Array, cb: P): Array<$Refine>; -type A = { kind: 'A', u: number } -type B = { kind: 'B', v: string } -type C = { kind: 'C', y: boolean } -type D = { kind: 'D', x: boolean } -type E = { kind: 'E', y: boolean } +type A = { kind: \'A\', u: number } +type B = { kind: \'B\', v: string } +type C = { kind: \'C\', y: boolean } +type D = { kind: \'D\', x: boolean } +type E = { kind: \'E\', y: boolean } declare var ab: Array; -(my_filter(ab, (x): %checks => x.kind === 'A'): Array); // ERROR -(my_filter(ab, (x): %checks => x.kind !== 'A'): Array); // ERROR +(my_filter(ab, (x): %checks => x.kind === \'A\'): Array); // ERROR +(my_filter(ab, (x): %checks => x.kind !== \'A\'): Array); // ERROR ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (16:20) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Filter the contents of an array +// ERROR +// ERROR +declare function my_filter>(v: Array, +cb: P): Array<$Refine>; +type A = { kind: \"A\"; u: number }; +type B = { kind: \"B\"; v: string }; +type C = { kind: \"C\"; y: boolean }; +type D = { kind: \"D\"; x: boolean }; +type E = { kind: \"E\"; y: boolean }; +declare var ab: Array; +(my_filter(ab, x => x.kind === \"A\"): Array); +(my_filter(ab, x => x.kind !== \"A\"): Array); " `; @@ -236,7 +254,7 @@ var e = refine3(c, d, e, is_string_and_number); (e: string); function is_string_and_number(x, y): %checks { - return typeof x === "string" && typeof y === "number"; + return typeof x === \"string\" && typeof y === \"number\"; } @@ -248,31 +266,52 @@ var e = refine(a, is_string_regular); // ERROR: is_string_regular is not a //////////////////////////////////////////////////////////////////////////////// function is_string(x): %checks { - return typeof x === "string"; + return typeof x === \"string\"; } function is_string_regular(x) { - return typeof x === "string"; + return typeof x === \"string\"; } function is_string_and_number(x, y): %checks { - return typeof x === "string" && typeof y === "number"; + return typeof x === \"string\" && typeof y === \"number\"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (22:37) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Sanity check A: the refinment position index is outside of the allowed range +// ERROR: index out of bounds +// Sanity check B: refine2 expects a function that accepts 3 arguments but +// it is called with a function that takes 2 +// Sanity check C: expecting a predicate function but passed a non-predicate one +// ERROR: is_string_regular is not a +// predicate function +//////////////////////////////////////////////////////////////////////////////// +declare function refine>(v: T, cb: P): $Refine; +declare var a: mixed; +var b = refine(a, is_string); +(b: string); +declare var c: mixed; +declare var d: mixed; +declare var e: mixed; +declare function refine3>(u: T, +v: T, +w: T, +cb: P): $Refine; +var e = refine3(c, d, e, is_string_and_number); +(e: string); +function is_string_and_number(x, y): %checks { + return typeof x === \"string\" && typeof y === \"number\"; +} +var e = refine(a, is_string_regular); +(e: number); +function is_string(x): %checks { + return typeof x === \"string\"; +} +function is_string_regular(x) { + return typeof x === \"string\"; +} +function is_string_and_number(x, y): %checks { + return typeof x === \"string\" && typeof y === \"number\"; +} " `; diff --git a/tests/predicates-declared/__snapshots__/jsfmt.spec.js.snap b/tests/predicates-declared/__snapshots__/jsfmt.spec.js.snap index cdb2a07db..78bfd93d9 100644 --- a/tests/predicates-declared/__snapshots__/jsfmt.spec.js.snap +++ b/tests/predicates-declared/__snapshots__/jsfmt.spec.js.snap @@ -37,31 +37,51 @@ class D { } declare var m: Function; -const x = ""; +const x = \"\"; if (m.bind(this)(x)) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/ast-types/lib/types.js:60 - throw new Error(str + " does not match type " + this); - ^ - -Error: {type: NumericLiteralTypeAnnotation, start: 288, end: 289, loc: [object Object], value: 1, extra: [object Object]} does not match type Printable - at Type.Tp.assert (/node_modules/ast-types/lib/types.js:60:19) - at genericPrintNoParens (/src/printer.js:221:24) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) - at printGenerically (/src/printer.js:111:12) - at FastPath.call (/src/fast-path.js:113:16) - at genericPrintNoParens (/src/printer.js:1254:25) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) +// @flow +// Sanity checks: +// - use of bind in a position of a function predicate. +// (This case should fall through, as method calls +// are currently not supported.) The original behavior +// (including \`havoc\`) should be retained. +class C { + m() { + return true; + } + a: 1; + n() { + if (this.m.bind(this)) { + this.a; + } + } +} +declare var m: Function; +const o = { a: 1 }; +if (m.bind(o)) { + o.a; +} +class D { + m: Function; + n() { + if (this.m({})) { + + } + } +} +declare var m: Function; +const x = \"\"; +if (m.bind(this)(x)) { + +} " `; exports[`test function-union.js 1`] = ` "// @flow -declare function f1(x: mixed): boolean %checks(typeof x === "string"); +declare function f1(x: mixed): boolean %checks(typeof x === \"string\"); declare function f2(x: mixed): boolean %checks(Array.isArray(x)); declare var cond: boolean; @@ -78,29 +98,27 @@ function foo(x: number | string | Array): number { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (3:39) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) +// @flow +// Feature check: +declare function f1(x: mixed): boolean; +declare function f2(x: mixed): boolean; +declare var cond: boolean; +function foo(x: number | string | Array): number { + var f = (cond ? f1 : f2); + if (f(x)) { + return x.length; + } else { + return 1; + } +} " `; exports[`test is-string-decl.js 1`] = ` "// @flow -declare function is_string(x: mixed): boolean %checks(typeof x === "string"); -declare function is_number(x: mixed): boolean %checks(typeof x === "number"); +declare function is_string(x: mixed): boolean %checks(typeof x === \"string\"); +declare function is_number(x: mixed): boolean %checks(typeof x === \"number\"); // Feature check: function foo(x: string | Array): string { @@ -116,21 +134,22 @@ function foo(x: string | Array): string { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (3:46) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) +// @flow +// Feature check: +// The use of \`is_string\` as a conditional check +// should guarantee the narrowing of the type of \`x\` +// to string. +// Accordingly the negation of the above check +// guarantees that \`x\` here is an Array +declare function is_string(x: mixed): boolean; +declare function is_number(x: mixed): boolean; +function foo(x: string | Array): string { + if (is_string(x)) { + return x; + } else { + return x.join(); + } +} " `; @@ -142,11 +161,11 @@ exports[`test logical-or.js 1`] = ` // expressions (e.g. \`||\`) declare function r(x: string): number; -var s = 'a'; +var s = \'a\'; var n = r(s) || 1; (n: number); -var x = ""; +var x = \"\"; if (x = r(s) || 1) { (x: number); } @@ -158,21 +177,24 @@ function foo(x: mixed) { return 1; } (Number(dollars) || 0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/src/printer.js:1348 - fromString(", ").join(path.map(print, "params")), - ^ - -TypeError: fromString(...).join is not a function - at genericPrintNoParens (/src/printer.js:1348:26) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) - at printGenerically (/src/printer.js:111:12) - at FastPath.call (/src/fast-path.js:113:16) - at genericPrintNoParens (/src/printer.js:1254:25) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) +// @flow +// Sanity check: +// - conditional functions do not affect behavior of conditional +// expressions (e.g. \`||\`) +declare function r(x: string): number; +var s = \"a\"; +var n = r(s) || 1; +(n: number); +var x = \"\"; +if (x = r(s) || 1) { + (x: number); +} +declare var dollars: mixed; +function foo(x: mixed) { + return 1; +} +foo(dollars) || 0; +Number(dollars) || 0; " `; @@ -193,30 +215,29 @@ type Invitee = { function f(_this: { m: ?Meeting }): string { if (!_this.m) { - return "0"; + return \"0\"; } if (_this.m.es.some((a) => a.fbid === 0)) { } - return "3"; + return \"3\"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/src/printer.js:1497 - fromString(", ").join(path.map(print, "params")), - ^ - -TypeError: fromString(...).join is not a function - at genericPrintNoParens (/src/printer.js:1497:26) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) - at printGenerically (/src/printer.js:111:12) - at FastPath.call (/src/fast-path.js:113:16) - at genericPrintNoParens (/src/printer.js:1374:14) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) +// @flow +// Sanity check: +// - preserving \`havoc\` semantics +type Meeting = { organizer: ?Invitee; es: Array }; +type Invitee = { fbid: number }; +function f(_this: { m: ?Meeting }): string { + if (!_this.m) { + return \"0\"; + } + if (_this.m.es.some(a => a.fbid === 0)) { + + } + return \"3\"; +} " `; @@ -226,54 +247,25 @@ exports[`test orig-string-tag-check.js 1`] = ` // The original first-order case function foo(x: string | Array): string { - if (typeof x === "string") { - return x; // [ERROR] x: Array doesn't match return type + if (typeof x === \"string\") { + return x; // [ERROR] x: Array doesn\'t match return type } else { - return x.join(); // [ERROR] x: string doesn't have .join method + return x.join(); // [ERROR] x: string doesn\'t have .join method } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/src/printer.js:1497 - fromString(", ").join(path.map(print, "params")), - ^ - -TypeError: fromString(...).join is not a function - at genericPrintNoParens (/src/printer.js:1497:26) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) - at printGenerically (/src/printer.js:111:12) - at FastPath.call (/src/fast-path.js:113:16) - at genericPrintNoParens (/src/printer.js:1374:14) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) -" -`; - -exports[`test sanity-conditional.js 1`] = ` -"// @flow - -// ERROR: only allow conditional expressions in \`%checks\` - -declare function foo(x: string): mixed %checks(x = "1"); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (5:39) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) +// @flow +// The original first-order case +// [ERROR] x: Array doesn\'t match return type +// [ERROR] x: string doesn\'t have .join method +function foo(x: string | Array): string { + if (typeof x === \"string\") { + return x; + } else { + return x.join(); + } +} " `; @@ -287,26 +279,21 @@ declare function pred(x: T): boolean; function foo(s: Array): string { if (pred(s)) { - return "1"; + return \"1\"; } return 1; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/src/printer.js:1348 - fromString(", ").join(path.map(print, "params")), - ^ - -TypeError: fromString(...).join is not a function - at genericPrintNoParens (/src/printer.js:1348:26) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) - at printGenerically (/src/printer.js:111:12) - at FastPath.call (/src/fast-path.js:113:16) - at genericPrintNoParens (/src/printer.js:1254:25) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) +// @flow +// Sanity check: +// - we should still be getting an error at the second return statement +declare function pred(x: T): boolean; +function foo(s: Array): string { + if (pred(s)) { + return \"1\"; + } + return 1; +} " `; @@ -321,39 +308,37 @@ declare function pred(x: T): boolean; function foo(s: Array): string { if ((1)(s)) { - return "1"; + return \"1\"; } - if ((pred + 1)("s")) { - return "1"; + if ((pred + 1)(\"s\")) { + return \"1\"; } - return "1" + return \"1\" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/src/printer.js:1348 - fromString(", ").join(path.map(print, "params")), - ^ - -TypeError: fromString(...).join is not a function - at genericPrintNoParens (/src/printer.js:1348:26) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) - at printGenerically (/src/printer.js:111:12) - at FastPath.call (/src/fast-path.js:113:16) - at genericPrintNoParens (/src/printer.js:1254:25) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) +// @flow +// Sanity check: +// - invalid calls at predicate positions +declare function pred(x: T): boolean; +function foo(s: Array): string { + if (1(s)) { + return \"1\"; + } + if ((pred + 1)(\"s\")) { + return \"1\"; + } + return \"1\"; +} " `; exports[`test sanity-is-string-bug.js 1`] = ` "// @flow -declare function is_string(x: mixed): boolean %checks(typeof x === "string"); -declare function is_number(x: mixed): boolean %checks(typeof x === "number"); +declare function is_string(x: mixed): boolean %checks(typeof x === \"string\"); +declare function is_number(x: mixed): boolean %checks(typeof x === \"number\"); // Sanity check: // - Erroneous logic @@ -366,21 +351,19 @@ function bar(x: string | Array): string { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (3:46) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) +// @flow +// Sanity check: +// - Erroneous logic +// error: both string and Array can flow to x +declare function is_string(x: mixed): boolean; +declare function is_number(x: mixed): boolean; +function bar(x: string | Array): string { + if (is_number(x)) { + return x; + } else { + return x.join(); + } +} " `; @@ -392,25 +375,14 @@ exports[`test sanity-parameter-mismatch.js 1`] = ` declare function foo( input: mixed, types: string | Array -): boolean %checks(typeof input === "string" || Array.isArray(input)); +): boolean %checks(typeof input === \"string\" || Array.isArray(input)); foo(3, 3); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (8:11) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) +// @flow +// Sanity check: make sure the parameters are checked as usual +declare function foo(input: mixed, types: string | Array): boolean; +foo(3, 3); " `; @@ -420,32 +392,30 @@ exports[`test sanity-pred-with-body.js 1`] = ` // Sanity check: // - predicate functions cannot have bodies (can only be declarations) -function pred(x: mixed): boolean %checks(typeof x === "string") { // error: cannot use pred type here - return typeof x === "string"; +function pred(x: mixed): boolean %checks(typeof x === \"string\") { // error: cannot use pred type here + return typeof x === \"string\"; } function foo(x: string | Array): string { if (pred(x)) { return x; } - return "1" + return \"1\" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected { (6:33) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.expect (/node_modules/babylon/lib/index.js:1621:33) - at Parser.pp$1.parseBlock (/node_modules/babylon/lib/index.js:2119:8) - at Parser.pp$3.parseFunctionBody (/node_modules/babylon/lib/index.js:4004:22) - at Parser.parseFunctionBody (/node_modules/babylon/lib/index.js:5211:20) - at Parser.pp$1.parseFunction (/node_modules/babylon/lib/index.js:2257:8) - at Parser.pp$1.parseFunctionStatement (/node_modules/babylon/lib/index.js:1926:15) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1712:19) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) +// @flow +// Sanity check: +// - predicate functions cannot have bodies (can only be declarations) +// error: cannot use pred type here +function pred(x: mixed): boolean: %checks(typeof x === \"string\") { + return typeof x === \"string\"; +} +function foo(x: string | Array): string { + if (pred(x)) { + return x; + } + return \"1\"; +} " `; @@ -454,20 +424,7 @@ exports[`test sanity-return-type.js 1`] = ` declare function f2(x: mixed): string %checks(Array.isArray(x)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (3:38) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) +// @flow +declare function f2(x: mixed): string; " `; diff --git a/tests/predicates-declared/sanity-conditional.js b/tests/predicates-declared/sanity-conditional.js deleted file mode 100644 index d3d4ced87..000000000 --- a/tests/predicates-declared/sanity-conditional.js +++ /dev/null @@ -1,5 +0,0 @@ -// @flow - -// ERROR: only allow conditional expressions in `%checks` - -declare function foo(x: string): mixed %checks(x = "1"); diff --git a/tests/predicates-inferred/__snapshots__/jsfmt.spec.js.snap b/tests/predicates-inferred/__snapshots__/jsfmt.spec.js.snap index ca6faaf61..8f85dd8fb 100644 --- a/tests/predicates-inferred/__snapshots__/jsfmt.spec.js.snap +++ b/tests/predicates-inferred/__snapshots__/jsfmt.spec.js.snap @@ -1,10 +1,10 @@ exports[`test sanity.js 1`] = ` "// @flow -// Sanity check: shouldn't be allowed to declare a predicate AND use \`chekcs\` +// Sanity check: shouldn\'t be allowed to declare a predicate AND use \`chekcs\` -function check(y): %checks(typeof y === "string") { - return typeof y === "number"; +function check(y): %checks(typeof y === \"string\") { + return typeof y === \"number\"; } declare var y: number | boolean; @@ -16,7 +16,7 @@ if (check(y)) { // Sanity: disallowed body function indirect_is_number(y): %checks { var y = 1; - return typeof y === "number"; + return typeof y === \"number\"; } function bak(z: string | number): number { @@ -27,21 +27,27 @@ function bak(z: string | number): number { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (5:19) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Sanity check: shouldn\'t be allowed to declare a predicate AND use \`chekcs\` +// Sanity: disallowed body +function check(y): %checks(typeof y === \"string\") { + return typeof y === \"number\"; +} +declare var y: number | boolean; +if (check(y)) { + (y: number); +} +function indirect_is_number(y): %checks { + var y = 1; + return typeof y === \"number\"; +} +function bak(z: string | number): number { + if (indirect_is_number(z)) { + return z; + } else { + return z.length; + } +} " `; @@ -50,32 +56,29 @@ exports[`test sanity-multi-params.js 1`] = ` // Feature: multi params function multi_param(w,x,y,z): %checks { - return typeof z === "string"; + return typeof z === \"string\"; } function foo(x: string | Array): string { - if (multi_param("1", "2", x, "3")) { + if (multi_param(\"1\", \"2\", x, \"3\")) { return x; } else { return x.join(); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (4:31) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Feature: multi params +function multi_param(w, x, y, z): %checks { + return typeof z === \"string\"; +} +function foo(x: string | Array): string { + if (multi_param(\"1\", \"2\", x, \"3\")) { + return x; + } else { + return x.join(); + } +} " `; @@ -90,8 +93,8 @@ if (dotAccess(obj)) { } function dotAccess(head, create) { - const path = 'path.location'; - const stack = path.split('.'); + const path = \'path.location\'; + const stack = path.split(\'.\'); do { const key = stack.shift(); head = head[key] || create && (head[key] = {}); @@ -99,21 +102,21 @@ function dotAccess(head, create) { return head; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/src/printer.js:925 - if (endsWithBrace(doBody)) - ^ - -ReferenceError: endsWithBrace is not defined - at genericPrintNoParens (/src/printer.js:925:11) - at genericPrint (/src/printer.js:166:7) - at p (/src/printer.js:111:37) - at exports.printComments (/src/comments.js:327:20) - at printGenerically (/src/printer.js:111:12) - at /src/printer.js:1601:18 - at FastPath.map (/src/fast-path.js:167:19) - at printStatementSequence (/src/printer.js:1586:8) - at /src/printer.js:561:16 - at FastPath.call (/src/fast-path.js:113:16) +// @flow +declare var key: string; +declare var obj: { page: ?Object }; +if (dotAccess(obj)) { + (obj.page: Object); +} +function dotAccess(head, create) { + const path = \"path.location\"; + const stack = path.split(\".\"); + do { + const key = stack.shift(); + head = head[key] || create && (head[key] = {}); + } while (stack.length && head); + return head; +} " `; @@ -125,7 +128,7 @@ declare var y: mixed; // Sanity check: this should fail, because the preficate function // checks \`y\` instead of \`x\`. function err(x): %checks { - return typeof y === "string"; + return typeof y === \"string\"; } function foo(x: string | Array): string { @@ -136,21 +139,20 @@ function foo(x: string | Array): string { } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (7:17) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Sanity check: this should fail, because the preficate function +// checks \`y\` instead of \`x\`. +declare var y: mixed; +function err(x): %checks { + return typeof y === \"string\"; +} +function foo(x: string | Array): string { + if (err(x)) { + return x; + } else { + return x.join(); + } +} " `; @@ -158,15 +160,15 @@ exports[`test simple-predicate-func.js 1`] = ` "// @flow function is_string(y): %checks { - return typeof y === "string"; + return typeof y === \"string\"; } function is_bool(y): %checks { - return typeof y === "boolean"; + return typeof y === \"boolean\"; } function is_number(y): %checks { - return typeof y === "number"; + return typeof y === \"number\"; } // Feature check: @@ -206,11 +208,11 @@ function baz(z: string | number): number { // Feature: multi params function multi_param(w,x,y,z): %checks { - return typeof z === "string"; + return typeof z === \"string\"; } function foo(x: string | Array): string { - if (multi_param("1", "2", "3", x)) { + if (multi_param(\"1\", \"2\", \"3\", x)) { return x; } else { return x.join(); @@ -229,21 +231,67 @@ function two_strings(x,y): %checks { declare function from_two_strings(x: string, y: string): void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (3:23) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Feature check: +// The use of \`is_string\` as a conditional check +// should guarantee the narrowing of the type of \`x\` +// to string. +// Accordingly the negation of the above check +// guarantees that \`x\` here is an Array +// Same as above but refining an offset +// Feature: multi params +function is_string(y): %checks { + return typeof y === \"string\"; +} +function is_bool(y): %checks { + return typeof y === \"boolean\"; +} +function is_number(y): %checks { + return typeof y === \"number\"; +} +function foo(x: string | Array): string { + if (is_string(x)) { + return x; + } else { + return x.join(); + } +} +function bar(z: { f: string | Array }): string { + if (is_string(z.f)) { + return z.f; + } else { + return z.f.join(); + } +} +function is_number_or_bool(y): %checks { + return is_number(y) || is_bool(y); +} +function baz(z: string | number): number { + if (is_number_or_bool(z)) { + return z; + } else { + return z.length; + } +} +function multi_param(w, x, y, z): %checks { + return typeof z === \"string\"; +} +function foo(x: string | Array): string { + if (multi_param(\"1\", \"2\", \"3\", x)) { + return x; + } else { + return x.join(); + } +} +function foo(a, b) { + if (two_strings(a, b)) { + from_two_strings(a, b); + } +} +function two_strings(x, y): %checks { + return is_string(x) && is_string(y); +} +declare function from_two_strings(x: string, y: string): void; " `; @@ -267,23 +315,26 @@ function foo(x: string | Array): string { } function is_string(x): %checks { - return typeof x === "string"; + return typeof x === \"string\"; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (19:23) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Feature check: +// The predicate function is defined after the conditional check +// The use of \`is_string\` as a conditional check +// should guarantee the narrowing of the type of \`x\` +// to string. +// Accordingly the negation of the above check +// guarantees that \`x\` here is an Array +function foo(x: string | Array): string { + if (is_string(x)) { + return x; + } else { + return x.join(); + } +} +function is_string(x): %checks { + return typeof x === \"string\"; +} " `; diff --git a/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap b/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap index 43d0eb7a3..b8b512258 100644 --- a/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap +++ b/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap @@ -1,25 +1,13 @@ exports[`test fail-0.js 1`] = ` "// @flow -// Error: 'declare', 'checks' but missing predicate +// Error: \'declare\', \'checks\' but missing predicate declare function f2(x: mixed): boolean %checks; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (5:39) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) +// @flow +// Error: \'declare\', \'checks\' but missing predicate +declare function f2(x: mixed): boolean; " `; @@ -30,21 +18,11 @@ exports[`test fail-1.js 1`] = ` function f6(x: mixed): %checks (x !== null) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (5:23) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Error: no return statement +function f6(x: mixed): %checks(x !== null) { + +} " `; @@ -55,21 +33,12 @@ var a2 = (x: mixed): %checks (x !== null) => { // Error: body form var x = 1; return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (3:19) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$1.parseVarStatement (/node_modules/babylon/lib/index.js:2043:8) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1735:19) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) - at Parser.parse (/node_modules/babylon/lib/index.js:1543:17) - at Object.parse$1 [as parse] (/node_modules/babylon/lib/index.js:6472:37) +// @flow +// Error: body form +var a2 = (x: mixed) => { + var x = 1; + return x; +}; " `; @@ -82,21 +51,12 @@ function f5(x: mixed): %checks (x !== null) { return x !== null } var a2 = (x: mixed): %checks (x !== null) => x !== null; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token (5:23) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp$7.flowParsePrimaryType (/node_modules/babylon/lib/index.js:5099:8) - at Parser.pp$7.flowParsePostfixType (/node_modules/babylon/lib/index.js:5105:19) - at Parser.pp$7.flowParsePrefixType (/node_modules/babylon/lib/index.js:5122:17) - at Parser.pp$7.flowParseAnonFunctionWithoutParens (/node_modules/babylon/lib/index.js:5127:20) - at Parser.pp$7.flowParseIntersectionType (/node_modules/babylon/lib/index.js:5141:19) - at Parser.pp$7.flowParseUnionType (/node_modules/babylon/lib/index.js:5151:19) - at Parser.pp$7.flowParseType (/node_modules/babylon/lib/index.js:5162:19) - at Parser.pp$7.flowParseTypeInitialiser (/node_modules/babylon/lib/index.js:4430:19) +// @flow +// Cannot declare predicate with a function body is present. +function f5(x: mixed): %checks(x !== null) { + return x !== null; +} +var a2 = (x: mixed) => x !== null; " `; @@ -129,96 +89,22 @@ type checks = any; declare function f(x: mixed): checks (typeof x === null); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (5:39) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$7.flowParseDeclareFunction (/node_modules/babylon/lib/index.js:4467:8) - at Parser.pp$7.flowParseDeclare (/node_modules/babylon/lib/index.js:4476:17) - at Parser.parseExpressionStatement (/node_modules/babylon/lib/index.js:5235:25) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1785:17) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) -" -`; - -exports[`test unsupported-0.js 1`] = ` -"// @flow - -// variables cannot be annotated with a predicate type - -var a3: (x: mixed) => boolean %checks (x !== null); -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (5:30) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$1.parseVarStatement (/node_modules/babylon/lib/index.js:2043:8) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1735:19) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) - at Parser.parse (/node_modules/babylon/lib/index.js:1543:17) - at Object.parse$1 [as parse] (/node_modules/babylon/lib/index.js:6472:37) -" -`; - -exports[`test unsupported-1.js 1`] = ` -"// @flow - -// (inited) variables cannot be annotated with a predicate type - -var a4: (x: mixed) => boolean %checks = (x: mixed) => x !== null; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (5:30) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$1.parseVarStatement (/node_modules/babylon/lib/index.js:2043:8) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1735:19) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) - at Parser.parse (/node_modules/babylon/lib/index.js:1543:17) - at Object.parse$1 [as parse] (/node_modules/babylon/lib/index.js:6472:37) -" -`; - -exports[`test unsupported-2.js 1`] = ` -"// @flow - -// Error: no support for checked preds - -var a5: (x: mixed) => boolean %checks(x !== null) = - (y: mixed) => typeof y !== "string"; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/node_modules/babylon/lib/index.js:4255 - throw err; - ^ - -SyntaxError: Unexpected token, expected ; (5:30) - at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4252:13) - at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1633:8) - at Parser.pp.semicolon (/node_modules/babylon/lib/index.js:1614:38) - at Parser.pp$1.parseVarStatement (/node_modules/babylon/lib/index.js:2043:8) - at Parser.pp$1.parseStatement (/node_modules/babylon/lib/index.js:1735:19) - at Parser.parseStatement (/node_modules/babylon/lib/index.js:5224:22) - at Parser.pp$1.parseBlockBody (/node_modules/babylon/lib/index.js:2139:21) - at Parser.pp$1.parseTopLevel (/node_modules/babylon/lib/index.js:1651:8) - at Parser.parse (/node_modules/babylon/lib/index.js:1543:17) - at Object.parse$1 [as parse] (/node_modules/babylon/lib/index.js:6472:37) +// @flow +declare function f1(x: mixed): boolean; +declare function f3(x: mixed): boolean; +declare function f4(x: mixed): boolean; +function f7(x: mixed): %checks { + return x !== null; +} +var a0 = (x: mixed) => x !== null; +var a1 = (x: mixed) => x !== null; +x => x !== null; +const insert_a_really_big_predicated_arrow_function_name_here = x => x !== null; +declare var x; +x; +checks => 123; +type checks = any; +declare function f(x: mixed): checks; +typeof x === null; " `; diff --git a/tests/predicates-parsing/unsupported-0.js b/tests/predicates-parsing/unsupported-0.js deleted file mode 100644 index 84ed10e27..000000000 --- a/tests/predicates-parsing/unsupported-0.js +++ /dev/null @@ -1,5 +0,0 @@ -// @flow - -// variables cannot be annotated with a predicate type - -var a3: (x: mixed) => boolean %checks (x !== null); diff --git a/tests/predicates-parsing/unsupported-1.js b/tests/predicates-parsing/unsupported-1.js deleted file mode 100644 index c9a7af823..000000000 --- a/tests/predicates-parsing/unsupported-1.js +++ /dev/null @@ -1,5 +0,0 @@ -// @flow - -// (inited) variables cannot be annotated with a predicate type - -var a4: (x: mixed) => boolean %checks = (x: mixed) => x !== null; diff --git a/tests/predicates-parsing/unsupported-2.js b/tests/predicates-parsing/unsupported-2.js deleted file mode 100644 index d4999b9c3..000000000 --- a/tests/predicates-parsing/unsupported-2.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow - -// Error: no support for checked preds - -var a5: (x: mixed) => boolean %checks(x !== null) = - (y: mixed) => typeof y !== "string"; diff --git a/tests/private/__snapshots__/jsfmt.spec.js.snap b/tests/private/__snapshots__/jsfmt.spec.js.snap index fbef504c9..3b7bea1e7 100644 --- a/tests/private/__snapshots__/jsfmt.spec.js.snap +++ b/tests/private/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test private.js 1`] = ` x: number; _x: string; __x: number; - constructor() { this.x = 0; this._x = \"\"; this.__x = 0; } + constructor() { this.x = 0; this._x = ""; this.__x = 0; } } class B extends A { @@ -20,7 +20,7 @@ class A { __x: number; constructor() { this.x = 0; - this._x = \"\"; + this._x = ""; this.__x = 0; } } diff --git a/tests/promises/__snapshots__/jsfmt.spec.js.snap b/tests/promises/__snapshots__/jsfmt.spec.js.snap index 9354e0c75..37b09bbf4 100644 --- a/tests/promises/__snapshots__/jsfmt.spec.js.snap +++ b/tests/promises/__snapshots__/jsfmt.spec.js.snap @@ -85,7 +85,7 @@ exports[`test covariance.js 1`] = ` async function testAll() { /* This is a test case from https://github.com/facebook/flow/issues/1143 - * which was previously an error due to Array\'s invariance and an improper + * which was previously an error due to Array's invariance and an improper * definition of Promise.all */ const x: Array> = []; const y: Promise> = Promise.all(x); @@ -100,7 +100,7 @@ async function testRace() { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ /* This is a test case from https://github.com/facebook/flow/issues/1143 - * which was previously an error due to Array\'s invariance and an improper + * which was previously an error due to Array's invariance and an improper * definition of Promise.all */ async function testAll() { const x: Array> = [ ]; @@ -170,10 +170,10 @@ new Promise(function(resolve, reject) { if (Math.random()) { resolve(42); } else { - resolve(\'str\'); + resolve('str'); } }).then(function(numOrStr) { - if (typeof numOrStr === \'string\') { + if (typeof numOrStr === 'string') { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -212,10 +212,10 @@ new Promise(function(resolve, reject) { if (Math.random()) { reject(42); } else { - reject(\'str\'); + reject('str'); } }).catch(function(numOrStr) { - if (typeof numOrStr === \'string\') { + if (typeof numOrStr === 'string') { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -273,7 +273,7 @@ Promise.reject(Promise.resolve(0)).then(function(num) { // resolvedPromise.then():T -> then(T) Promise.resolve(0) - .then(function(num) { return \'asdf\'; }) + .then(function(num) { return 'asdf'; }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -281,7 +281,7 @@ Promise.resolve(0) // resolvedPromise.then():Promise -> then(T) Promise.resolve(0) - .then(function(num) { return Promise.resolve(\'asdf\'); }) + .then(function(num) { return Promise.resolve('asdf'); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -289,7 +289,7 @@ Promise.resolve(0) // resolvedPromise.then():Promise> -> then(T) Promise.resolve(0) - .then(function(num) { return Promise.resolve(Promise.resolve(\'asdf\')); }) + .then(function(num) { return Promise.resolve(Promise.resolve('asdf')); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -298,7 +298,7 @@ Promise.resolve(0) // TODO: resolvedPromise.then() -> catch(T) Promise.resolve(0) .then(function(num) { - throw \'str\'; + throw 'str'; }) .catch(function(str) { var a: string = str; @@ -313,7 +313,7 @@ Promise.resolve(0) // rejectedPromise.catch():U -> then(U) Promise.reject(0) - .catch(function(num) { return \'asdf\'; }) + .catch(function(num) { return 'asdf'; }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -321,7 +321,7 @@ Promise.reject(0) // rejectedPromise.catch():Promise -> then(U) Promise.reject(0) - .catch(function(num) { return Promise.resolve(\'asdf\'); }) + .catch(function(num) { return Promise.resolve('asdf'); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -329,7 +329,7 @@ Promise.reject(0) // rejectedPromise.catch():Promise> -> then(U) Promise.reject(0) - .catch(function(num) { return Promise.resolve(Promise.resolve(\'asdf\')); }) + .catch(function(num) { return Promise.resolve(Promise.resolve('asdf')); }) .then(function(str) { var a: string = str; var b: number = str; // Error: string ~> number @@ -476,12 +476,12 @@ new Promise( if (Math.random()) { resolve(42); } else { - resolve(\"str\"); + resolve("str"); } } ).then( function(numOrStr) { - if (typeof numOrStr === \"string\") { + if (typeof numOrStr === "string") { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -520,12 +520,12 @@ new Promise( if (Math.random()) { reject(42); } else { - reject(\"str\"); + reject("str"); } } ).catch( function(numOrStr) { - if (typeof numOrStr === \"string\") { + if (typeof numOrStr === "string") { var a: string = numOrStr; } else { var b: number = numOrStr; @@ -565,7 +565,7 @@ Promise.reject(Promise.resolve(0)).then( ); Promise.resolve(0).then( function(num) { - return \"asdf\"; + return "asdf"; } ).then( function(str) { @@ -575,7 +575,7 @@ Promise.resolve(0).then( ); Promise.resolve(0).then( function(num) { - return Promise.resolve(\"asdf\"); + return Promise.resolve("asdf"); } ).then( function(str) { @@ -585,7 +585,7 @@ Promise.resolve(0).then( ); Promise.resolve(0).then( function(num) { - return Promise.resolve(Promise.resolve(\"asdf\")); + return Promise.resolve(Promise.resolve("asdf")); } ).then( function(str) { @@ -595,7 +595,7 @@ Promise.resolve(0).then( ); Promise.resolve(0).then( function(num) { - throw \"str\"; + throw "str"; } ).catch( function(str) { @@ -605,7 +605,7 @@ Promise.resolve(0).then( ); Promise.reject(0).catch( function(num) { - return \"asdf\"; + return "asdf"; } ).then( function(str) { @@ -615,7 +615,7 @@ Promise.reject(0).catch( ); Promise.reject(0).catch( function(num) { - return Promise.resolve(\"asdf\"); + return Promise.resolve("asdf"); } ).then( function(str) { @@ -625,7 +625,7 @@ Promise.reject(0).catch( ); Promise.reject(0).catch( function(num) { - return Promise.resolve(Promise.resolve(\"asdf\")); + return Promise.resolve(Promise.resolve("asdf")); } ).then( function(str) { @@ -662,7 +662,7 @@ class Promise {} */ async function foo(x: boolean) { if (x) { - return {bar: \'baz\'}; + return {bar: 'baz'}; } else { return null; } @@ -708,7 +708,7 @@ async function baz(): Promise { class Promise {} async function foo(x: boolean) { if (x) { - return { bar: \"baz\" }; + return { bar: "baz" }; } else { return null; } diff --git a/tests/qualified/__snapshots__/jsfmt.spec.js.snap b/tests/qualified/__snapshots__/jsfmt.spec.js.snap index f43caef88..2a2c27c61 100644 --- a/tests/qualified/__snapshots__/jsfmt.spec.js.snap +++ b/tests/qualified/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ declare var of_type_foo: foo; type bar = typeof of_type_foo.bar; var a: bar = 42; -var b: bar = \'asdf\'; // Error: string ~> number +var b: bar = 'asdf'; // Error: string ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Error: string ~> number class C {} @@ -20,6 +20,6 @@ type foo = { bar: number }; declare var of_type_foo: foo; type bar = typeof of_type_foo.bar; var a: bar = 42; -var b: bar = \"asdf\"; +var b: bar = "asdf"; " `; diff --git a/tests/react/__snapshots__/jsfmt.spec.js.snap b/tests/react/__snapshots__/jsfmt.spec.js.snap index c3db9f23f..86e909c1d 100644 --- a/tests/react/__snapshots__/jsfmt.spec.js.snap +++ b/tests/react/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test ArityError.react.js 1`] = ` "/** * @providesModule ArityError.react */ -var React = require(\'react\'); +var React = require('react'); var AudienceInsightsContainer = React.createClass({ renderComponent(AudienceInsights: ReactClass<*>) { return ; @@ -14,7 +14,7 @@ module.exports = AudienceInsightsContainer; /** * @providesModule ArityError.react */ -var React = require(\"react\"); +var React = require("react"); var AudienceInsightsContainer = React.createClass({ renderComponent(AudienceInsights: ReactClass<*>) { return ; @@ -26,23 +26,23 @@ module.exports = AudienceInsightsContainer; exports[`test createElement_string.js 1`] = ` "// @flow -import React from \'react\'; +import React from 'react'; class Bar extends React.Component {} class Foo extends React.Component { render() { - const Cmp = Math.random() < 0.5 ? \'div\' : Bar; + const Cmp = Math.random() < 0.5 ? 'div' : Bar; return (); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import React from \"react\"; +import React from "react"; class Bar extends React.Component {} class Foo extends React.Component { render() { - const Cmp = (Math.random() < 0.5 ? \"div\" : Bar); + const Cmp = (Math.random() < 0.5 ? "div" : Bar); return ; } } @@ -51,7 +51,7 @@ class Foo extends React.Component { exports[`test createElementRequiredProp_string.js 1`] = ` "// @flow -import React from \'react\'; +import React from 'react'; class Bar extends React.Component { props: { @@ -68,13 +68,13 @@ class Bar extends React.Component { class Foo extends React.Component { render() { - const Cmp = Math.random() < 0.5 ? \'div\' : Bar; + const Cmp = Math.random() < 0.5 ? 'div' : Bar; return (); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import React from \"react\"; +import React from "react"; class Bar extends React.Component { props: { test: number }; render() { @@ -87,7 +87,7 @@ class Bar extends React.Component { } class Foo extends React.Component { render() { - const Cmp = (Math.random() < 0.5 ? \"div\" : Bar); + const Cmp = (Math.random() < 0.5 ? "div" : Bar); return ; } } @@ -97,16 +97,16 @@ class Foo extends React.Component { exports[`test import_react.js 1`] = ` "/* @flow */ -import react from \"react\"; -import {Component} from \"react\"; +import react from "react"; +import {Component} from "react"; var a: Component<*,*,*> = new react.Component(); var b: number = new react.Component(); // Error: ReactComponent ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error: ReactComponent ~> number -import react from \"react\"; -import { Component } from \"react\"; +import react from "react"; +import { Component } from "react"; var a: Component<*, *, *> = new react.Component(); var b: number = new react.Component(); " @@ -115,7 +115,7 @@ var b: number = new react.Component(); exports[`test jsx_spread.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); var Foo = React.createClass({ propTypes: { bar: React.PropTypes.string.isRequired, @@ -127,7 +127,7 @@ var blah = ; // error bar, number given string expected ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error bar, number given string expected -var React = require(\"react\"); +var React = require("react"); var Foo = React.createClass({ propTypes: { bar: React.PropTypes.string.isRequired } }); @@ -139,7 +139,7 @@ var blah = ; exports[`test proptype_arrayOf.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); var Example = React.createClass({ propTypes: { arr: React.PropTypes.arrayOf(React.PropTypes.number).isRequired @@ -150,24 +150,24 @@ var ok_empty = var ok_numbers = var fail_not_array = -var fail_mistyped_elems = +var fail_mistyped_elems = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\"react\"); +var React = require("react"); var Example = React.createClass({ propTypes: { arr: React.PropTypes.arrayOf(React.PropTypes.number).isRequired } }); var ok_empty = ; var ok_numbers = ; var fail_not_array = ; -var fail_mistyped_elems = ; +var fail_mistyped_elems = ; " `; exports[`test proptype_func.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); var Example = React.createClass({ propTypes: { func: React.PropTypes.func.isRequired @@ -181,7 +181,7 @@ var ok_retval = 1} /> var fail_mistyped = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\"react\"); +var React = require("react"); var Example = React.createClass({ propTypes: { func: React.PropTypes.func.isRequired } }); @@ -199,10 +199,10 @@ var fail_mistyped = ; exports[`test proptype_missing.js 1`] = ` "/* @flow */ -/* If you create a react component with createClass() but don\'t specify the +/* If you create a react component with createClass() but don't specify the * propTypes, what should the type of props be? * - * It used to be an empty object, but we didn\'t enforce that correctly, so + * It used to be an empty object, but we didn't enforce that correctly, so * people could do whatever they wanted with this.props. * * As of 0.21.0 it started to be an error when people used this.props in a @@ -210,15 +210,15 @@ exports[`test proptype_missing.js 1`] = ` * enforced, so glevi changed this.props to be Object by default. * * We may change this back to the empty object at some point and fix the - * situations where it didn\'t used to error + * situations where it didn't used to error */ var React = React.createClass({ getID(): string { - // So this would have been an error in 0.21.0 if we didn\'t make this.props + // So this would have been an error in 0.21.0 if we didn't make this.props // Object switch (this.props.name) { - case \'a\': return \'Bob\'; - default: return \'Alice\'; + case 'a': return 'Bob'; + default: return 'Alice'; } }, @@ -229,10 +229,10 @@ var React = React.createClass({ }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -/* If you create a react component with createClass() but don\'t specify the +/* If you create a react component with createClass() but don't specify the * propTypes, what should the type of props be? * - * It used to be an empty object, but we didn\'t enforce that correctly, so + * It used to be an empty object, but we didn't enforce that correctly, so * people could do whatever they wanted with this.props. * * As of 0.21.0 it started to be an error when people used this.props in a @@ -240,18 +240,18 @@ var React = React.createClass({ * enforced, so glevi changed this.props to be Object by default. * * We may change this back to the empty object at some point and fix the - * situations where it didn\'t used to error + * situations where it didn't used to error */ -// So this would have been an error in 0.21.0 if we didn\'t make this.props +// So this would have been an error in 0.21.0 if we didn't make this.props // Object // But this never errored var React = React.createClass({ getID(): string { switch (this.props.name) { - case \"a\": - return \"Bob\"; + case "a": + return "Bob"; default: - return \"Alice\"; + return "Alice"; } }, render() { @@ -264,7 +264,7 @@ var React = React.createClass({ exports[`test proptype_object.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); var Example = React.createClass({ propTypes: { object: React.PropTypes.object.isRequired @@ -272,17 +272,17 @@ var Example = React.createClass({ }); var ok_empty = ; -var ok_props = ; +var ok_props = ; var fail_mistyped = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\"react\"); +var React = require("react"); var Example = React.createClass({ propTypes: { object: React.PropTypes.object.isRequired } }); var ok_empty = ; -var ok_props = ; +var ok_props = ; var fail_mistyped = ; " `; @@ -290,7 +290,7 @@ var fail_mistyped = ; exports[`test proptype_objectOf.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); var Example = React.createClass({ propTypes: { obj: React.PropTypes.objectOf(React.PropTypes.number).isRequired @@ -301,10 +301,10 @@ var ok_empty = var ok_numbers = var fail_not_object = -var fail_mistyped_props = +var fail_mistyped_props = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\"react\"); +var React = require("react"); var Example = React.createClass({ propTypes: { obj: React.PropTypes.objectOf(React.PropTypes.number).isRequired @@ -313,37 +313,37 @@ var Example = React.createClass({ var ok_empty = ; var ok_numbers = ; var fail_not_object = ; -var fail_mistyped_props = ; +var fail_mistyped_props = ; " `; exports[`test proptype_oneOf.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); var Example = React.createClass({ propTypes: { - literal: React.PropTypes.oneOf([\"foo\"]).isRequired + literal: React.PropTypes.oneOf(["foo"]).isRequired }, }); -var ex1 = ; -var ex2 = ; +var ex1 = ; +var ex2 = ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\"react\"); +var React = require("react"); var Example = React.createClass({ - propTypes: { literal: React.PropTypes.oneOf([ \"foo\" ]).isRequired } + propTypes: { literal: React.PropTypes.oneOf([ "foo" ]).isRequired } }); -var ex1 = ; -var ex2 = ; +var ex1 = ; +var ex2 = ; " `; exports[`test proptype_oneOfType.js 1`] = ` "/* @flow */ -var React = require(\'react\'); +var React = require('react'); var Example = React.createClass({ propTypes: { prop: React.PropTypes.oneOfType([ @@ -352,7 +352,7 @@ var Example = React.createClass({ ]).isRequired }, render() { - if (typeof this.props.prop === \"string\") { + if (typeof this.props.prop === "string") { return
{this.props.prop}
} else { return
{this.props.prop.toFixed(2)}
@@ -361,12 +361,12 @@ var Example = React.createClass({ }); var ok_number = ; -var ok_string = ; +var ok_string = ; var fail_bool = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require(\"react\"); +var React = require("react"); var Example = React.createClass({ propTypes: { prop: React.PropTypes.oneOfType( @@ -374,7 +374,7 @@ var Example = React.createClass({ ).isRequired }, render() { - if (typeof this.props.prop === \"string\") { + if (typeof this.props.prop === "string") { return
{this.props.prop}
; } else { return
{this.props.prop.toFixed(2)}
; @@ -382,7 +382,7 @@ var Example = React.createClass({ } }); var ok_number = ; -var ok_string = ; +var ok_string = ; var fail_bool = ; " `; diff --git a/tests/react_functional/__snapshots__/jsfmt.spec.js.snap b/tests/react_functional/__snapshots__/jsfmt.spec.js.snap index 6d48d7f6c..b9e197b8c 100644 --- a/tests/react_functional/__snapshots__/jsfmt.spec.js.snap +++ b/tests/react_functional/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test test.js 1`] = ` -"import React from \"react\"; +"import React from "react"; function F(props: { foo: string }) {} ; // error: missing \`foo\` ; // error: number ~> string -; // ok +; // ok // props subtyping is property-wise covariant function G(props: { foo: string|numner }) {} -; // ok +; // ok var Z = 0; ; // error, expected React component @@ -19,17 +19,17 @@ var Z = 0; // props subtyping is property-wise covariant // ok // error, expected React component -import React from \"react\"; +import React from "react"; function F(props: { foo: string }) { } ; ; -; +; function G(props: { foo: string | numner }) { } -; +; var Z = 0; ; " diff --git a/tests/react_modules/__snapshots__/jsfmt.spec.js.snap b/tests/react_modules/__snapshots__/jsfmt.spec.js.snap index 94dd2c52c..061e9dcf6 100644 --- a/tests/react_modules/__snapshots__/jsfmt.spec.js.snap +++ b/tests/react_modules/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ exports[`test createclass-callsite.js 1`] = ` "/* @flow */ -var React = require('react'); -var Hello = require('./createclass-module'); +var React = require(\'react\'); +var Hello = require(\'./createclass-module\'); var HelloLocal = React.createClass({ propTypes: { @@ -27,8 +27,8 @@ var Callsite = React.createClass({ module.exports = Callsite; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); -var Hello = require("./createclass-module"); +var React = require(\"react\"); +var Hello = require(\"./createclass-module\"); var HelloLocal = React.createClass({ propTypes: { name: React.PropTypes.string.isRequired }, render: function(): React.Element<*> { @@ -51,7 +51,7 @@ module.exports = Callsite; exports[`test createclass-module.js 1`] = ` "/* @flow */ -var React = require('react'); +var React = require(\'react\'); var Hello = React.createClass({ propTypes: { @@ -66,7 +66,7 @@ var Hello = React.createClass({ module.exports = Hello; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var React = require("react"); +var React = require(\"react\"); var Hello = React.createClass({ propTypes: { name: React.PropTypes.string.isRequired }, render: function(): React.Element<*> { @@ -77,94 +77,10 @@ module.exports = Hello; " `; -exports[`test es6class-proptypes-callsite.js 1`] = ` -"/* @flow */ -import React from 'react'; -import Hello from './es6class-proptypes-module'; - -class HelloLocal extends React.Component { - defaultProps = {}; - propTypes = { - name: React.PropTypes.string.isRequired, - }; - render(): React.Element<*> { - return
{this.props.name}
; - } -} - -class Callsite extends React.Component { - render(): React.Element<*> { - return ( -
- - -
- ); - } -} - -module.exports = Callsite; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -import React from "react"; -import Hello from "./es6class-proptypes-module"; -class HelloLocal extends React.Component { - defaultProps; - =(}, - propTypes = { name: React.PropTypes.string.isRequired }, - render): React.Element<*> { - return
{this.props.name}
; - } -} -class Callsite extends React.Component { - render(): React.Element<*> { - return ( -
- - -
- ); - } -} -module.exports = Callsite; -" -`; - -exports[`test es6class-proptypes-module.js 1`] = ` -"/* @flow */ -import React from 'react'; - -class Hello extends React.Component { - defaultProps = {}; - propTypes = { - name: React.PropTypes.string.isRequired, - }; - - render(): React.Element<*> { - return
{this.props.name}
; - } -} - -module.exports = Hello; -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/* @flow */ -import React from "react"; -class Hello extends React.Component { - defaultProps; - =(}, - propTypes = { name: React.PropTypes.string.isRequired }, - render): React.Element<*> { - return
{this.props.name}
; - } -} -module.exports = Hello; -" -`; - exports[`test es6class-types-callsite.js 1`] = ` "/* @flow */ -import React from 'react'; -import Hello from './es6class-types-module'; +import React from \'react\'; +import Hello from \'./es6class-types-module\'; type Props = {name: string}; @@ -190,8 +106,8 @@ class Callsite extends React.Component { module.exports = Callsite; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import React from "react"; -import Hello from "./es6class-types-module"; +import React from \"react\"; +import Hello from \"./es6class-types-module\"; type Props = { name: string }; class HelloLocal extends React.Component { props: Props; @@ -215,7 +131,7 @@ module.exports = Callsite; exports[`test es6class-types-module.js 1`] = ` "/* @flow */ -import React from 'react'; +import React from \'react\'; type Props = {name: string}; @@ -231,7 +147,7 @@ class Hello extends React.Component<{}, Props, void>{ module.exports = Hello; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -import React from "react"; +import React from \"react\"; type Props = { name: string }; class Hello extends React.Component<{}, Props, void> { props: Props; diff --git a/tests/react_modules/es6class-proptypes-callsite.js b/tests/react_modules/es6class-proptypes-callsite.js deleted file mode 100644 index 6a50aa90e..000000000 --- a/tests/react_modules/es6class-proptypes-callsite.js +++ /dev/null @@ -1,26 +0,0 @@ -/* @flow */ -import React from 'react'; -import Hello from './es6class-proptypes-module'; - -class HelloLocal extends React.Component { - defaultProps = {}; - propTypes = { - name: React.PropTypes.string.isRequired, - }; - render(): React.Element<*> { - return
{this.props.name}
; - } -} - -class Callsite extends React.Component { - render(): React.Element<*> { - return ( -
- - -
- ); - } -} - -module.exports = Callsite; diff --git a/tests/react_modules/es6class-proptypes-module.js b/tests/react_modules/es6class-proptypes-module.js deleted file mode 100644 index 86e55da1b..000000000 --- a/tests/react_modules/es6class-proptypes-module.js +++ /dev/null @@ -1,15 +0,0 @@ -/* @flow */ -import React from 'react'; - -class Hello extends React.Component { - defaultProps = {}; - propTypes = { - name: React.PropTypes.string.isRequired, - }; - - render(): React.Element<*> { - return
{this.props.name}
; - } -} - -module.exports = Hello; diff --git a/tests/rec/__snapshots__/jsfmt.spec.js.snap b/tests/rec/__snapshots__/jsfmt.spec.js.snap index 255c86b89..0f0530a61 100644 --- a/tests/rec/__snapshots__/jsfmt.spec.js.snap +++ b/tests/rec/__snapshots__/jsfmt.spec.js.snap @@ -20,7 +20,7 @@ function identity
(val: A): Functor { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type F = { foo: : (x: A) => F }; +type F = { foo(x: A): F }; declare function foo(x: any): F; ({ foo }: F); function bar(y: F): F { @@ -32,7 +32,7 @@ function bar1(y: F): F { function bar2(y: F): F { return y; } -type Functor = { map: : (f: (val: A) => B) => Functor }; +type Functor = { map(f: (val: A) => B): Functor }; function identity(val: A): Functor { return { map(f: (_: typeof val) => B): Functor { @@ -55,7 +55,7 @@ function id(x: Task): Task { return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ type Task = { - chain: : (next: (input: value) => Task) => Task + chain(next: (input: value) => Task): Task }; function id(x: Task): Task { return x; @@ -196,13 +196,13 @@ function bar(x: P): () => P { // terminate despite expanding types, error // P = () => { x: P } // () => P = () => () => { x: P } -type I = : () => I>; -type J = : () => J>; +type I = () => I>; +type J = () => J>; function foo(x: I): J { return x; } type Q = { x: X }; -type P = : () => Q>; +type P = () => Q>; function bar(x: P): () => P { return x; } diff --git a/tests/recheck/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/__snapshots__/jsfmt.spec.js.snap index 2a556a589..26dbe459b 100644 --- a/tests/recheck/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/__snapshots__/jsfmt.spec.js.snap @@ -19,25 +19,25 @@ module.exports = foo; exports[`test a2.js 1`] = ` "// @flow -const foo = require(\'./a1\'); +const foo = require('./a1'); -module.exports = foo(\"\"); +module.exports = foo(""); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const foo = require(\"./a1\"); -module.exports = foo(\"\"); +const foo = require("./a1"); +module.exports = foo(""); " `; exports[`test a3.js 1`] = ` "// @flow -const five = require(\'./a2\'); +const five = require('./a2'); (five + five: string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -const five = require(\"./a2\"); +const five = require("./a2"); (five + five: string); " `; @@ -64,7 +64,7 @@ module.exports = { C, E }; exports[`test b1.js 1`] = ` "// @flow -import { C, E } from \"./b0\"; +import { C, E } from "./b0"; function foo() { return C; } function bar() { return E; } let X = foo(); @@ -73,7 +73,7 @@ class D extends F { } module.exports = { C, D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C, E } from \"./b0\"; +import { C, E } from "./b0"; function foo() { return C; } @@ -90,22 +90,22 @@ module.exports = { C, D }; exports[`test b2.js 1`] = ` "// @flow -module.exports = require(\"./b1\"); +module.exports = require("./b1"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -module.exports = require(\"./b1\"); +module.exports = require("./b1"); " `; exports[`test b3.js 1`] = ` "// @flow -import { C, D } from \"./b2\"; +import { C, D } from "./b2"; (new D: C); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C, D } from \"./b2\"; +import { C, D } from "./b2"; (new D(): C); " `; @@ -125,14 +125,14 @@ export function foo(props: { x: number }) { exports[`test c2.js 1`] = ` "// @flow -import { foo } from \"./c1\"; +import { foo } from "./c1"; export function bar(props: { x: number }) { foo({ x: 0 }); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { foo } from \"./c1\"; +import { foo } from "./c1"; export function bar(props: { x: number }) { foo({ x: 0 }); } @@ -142,12 +142,12 @@ export function bar(props: { x: number }) { exports[`test c3.js 1`] = ` "// @flow -import { bar } from \"./c2\"; +import { bar } from "./c2"; bar({ x: 0 }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { bar } from \"./c2\"; +import { bar } from "./c2"; bar({ x: 0 }); " `; @@ -169,11 +169,11 @@ export var x = new A(); exports[`test d2.js 1`] = ` "// @flow -import {A, x} from \"./d1\"; +import {A, x} from "./d1"; export var y: A = x; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { A, x } from \"./d1\"; +import { A, x } from "./d1"; export var y: A = x; " `; @@ -182,14 +182,14 @@ exports[`test e1.js 1`] = ` "// @flow export type Action = - | { type: \'FOO\' } - | { type: \'BAR\' } + | { type: 'FOO' } + | { type: 'BAR' } ; export const LIFE = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: \"FOO\" } | { type: \"BAR\" }; +export type Action = { type: "FOO" } | { type: "BAR" }; export const LIFE = 42; " `; @@ -197,22 +197,22 @@ export const LIFE = 42; exports[`test e2.js 1`] = ` "// @flow -import type { Action } from \'./e1\'; +import type { Action } from './e1'; const f = (): Action => { - return { type: \'FOO\' }; + return { type: 'FOO' }; } -import { LIFE } from \'./e1\'; +import { LIFE } from './e1'; (LIFE: 42); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Action } from \"./e1\"; +import type { Action } from "./e1"; const f = (): Action => { - return { type: \"FOO\" }; + return { type: "FOO" }; }; -import { LIFE } from \"./e1\"; +import { LIFE } from "./e1"; (LIFE: 42); " `; @@ -242,11 +242,11 @@ module.exports = { a, b, c }; exports[`test f2.js 1`] = ` "// @flow -var { a, b, c } = require(\'./f1\'); +var { a, b, c } = require('./f1'); (c: { x: number }); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -var { a, b, c } = require(\"./f1\"); +var { a, b, c } = require("./f1"); (c: { x: number }); " `; @@ -264,14 +264,14 @@ export class C {} exports[`test g2.js 1`] = ` "// @flow -import { C } from \'./g1\'; +import { C } from './g1'; class D extends C { } module.exports = { D }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C } from \"./g1\"; +import { C } from "./g1"; class D extends C {} module.exports = { D }; " @@ -280,14 +280,14 @@ module.exports = { D }; exports[`test g3.js 1`] = ` "// @flow -import { C } from \'./g1\'; -import { D } from \'./g2\'; +import { C } from './g1'; +import { D } from './g2'; (new D: C) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { C } from \"./g1\"; -import { D } from \"./g2\"; +import { C } from "./g1"; +import { D } from "./g2"; (new D(): C); " `; @@ -305,9 +305,9 @@ export type Foo = number; exports[`test h2.js 1`] = ` "// @flow -import type { Foo } from \'./h1\'; +import type { Foo } from './h1'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Foo } from \"./h1\"; +import type { Foo } from "./h1"; " `; diff --git a/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap index 3563bd41b..95b484bec 100644 --- a/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp1c/__snapshots__/jsfmt.spec.js.snap @@ -1,14 +1,14 @@ exports[`test c2.js 1`] = ` "// @flow -import { foo } from \"./c1\"; +import { foo } from "./c1"; export function bar(props: { y: number }) { foo({ y: 0 }); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import { foo } from \"./c1\"; +import { foo } from "./c1"; export function bar(props: { y: number }) { foo({ y: 0 }); } diff --git a/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap index 53e7ab99f..15812cf6d 100644 --- a/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp2a/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test a1.js 1`] = ` function foo(x: number): number { return 5; } -foo(\"\"); +foo(""); module.exports = foo; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -11,7 +11,7 @@ module.exports = foo; function foo(x: number): number { return 5; } -foo(\"\"); +foo(""); module.exports = foo; " `; diff --git a/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap index 297c96fb1..736b343a3 100644 --- a/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp2e/__snapshots__/jsfmt.spec.js.snap @@ -2,14 +2,14 @@ exports[`test e1.js 1`] = ` "// @flow export type Action = - | { type: \'QUX\' } - | { type: \'BAR\' } + | { type: 'QUX' } + | { type: 'BAR' } ; export const LIFE = 42; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: \"QUX\" } | { type: \"BAR\" }; +export type Action = { type: "QUX" } | { type: "BAR" }; export const LIFE = 42; " `; diff --git a/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap b/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap index 390a9fafa..77244f151 100644 --- a/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap +++ b/tests/recheck/tmp3e/__snapshots__/jsfmt.spec.js.snap @@ -2,14 +2,14 @@ exports[`test e1.js 1`] = ` "// @flow export type Action = - | { type: \'QUX\' } - | { type: \'BAR\' } + | { type: 'QUX' } + | { type: 'BAR' } ; export const LIFE = 0; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -export type Action = { type: \"QUX\" } | { type: \"BAR\" }; +export type Action = { type: "QUX" } | { type: "BAR" }; export const LIFE = 0; " `; @@ -17,22 +17,22 @@ export const LIFE = 0; exports[`test e2.js 1`] = ` "// @flow -import type { Action } from \'./e1\'; +import type { Action } from './e1'; const f = (): Action => { - return { type: \'QUX\' }; + return { type: 'QUX' }; } -import { LIFE } from \'./e1\'; +import { LIFE } from './e1'; (LIFE: 0); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -import type { Action } from \"./e1\"; +import type { Action } from "./e1"; const f = (): Action => { - return { type: \"QUX\" }; + return { type: "QUX" }; }; -import { LIFE } from \"./e1\"; +import { LIFE } from "./e1"; (LIFE: 0); " `; diff --git a/tests/record/__snapshots__/jsfmt.spec.js.snap b/tests/record/__snapshots__/jsfmt.spec.js.snap index 3c34fd98f..ba3c22ffc 100644 --- a/tests/record/__snapshots__/jsfmt.spec.js.snap +++ b/tests/record/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test test.js 1`] = ` -"type Key1 = \'foo\' | \'bar\'; // make an enum type with known key set +"type Key1 = 'foo' | 'bar'; // make an enum type with known key set var o1: {[key: Key1]: number} = { foo: 0, - bar: \"\", // error: string ~/~ number + bar: "", // error: string ~/~ number }; o1.foo; // OK o1.qux; // error: qux not found @@ -15,7 +15,7 @@ o2.bar; // OK to access bar o2.qux; // error: qux not found class C { - x: $Subtype<{[key: $Keys]: any}>; // object with larger key set than X\'s + x: $Subtype<{[key: $Keys]: any}>; // object with larger key set than X's } class D extends C<{foo: number, bar: string}> { x: { foo: number, qux: boolean }; // error: qux not found @@ -33,14 +33,14 @@ var o3: {[key: AnyKey]: number} = { foo: 0 }; // OK to leave out bar // OK to access bar // error: qux not found -// object with larger key set than X\'s +// object with larger key set than X's // error: qux not found -type Key1 = \"foo\" | \"bar\"; -var o1: { [key: Key1]: number } = { foo: 0, bar: \"\" }; +type Key1 = "foo" | "bar"; +var o1: { [key: Key1]: number } = { foo: 0, bar: "" }; o1.foo; o1.qux; o1.toString(); -type R = { foo: any, bar: any }; +type R = { foo: any; bar: any }; type Key2 = $Keys; var o2: { [key: Key2]: number } = { foo: 0 }; o2.bar; @@ -48,8 +48,8 @@ o2.qux; class C { x: $Subtype<{ [key: $Keys]: any }>; } -class D extends C<{ foo: number, bar: string }> { - x: { foo: number, qux: boolean }; +class D extends C<{ foo: number; bar: string }> { + x: { foo: number; qux: boolean }; } type AnyKey = $Keys; var o3: { [key: AnyKey]: number } = { foo: 0 }; diff --git a/tests/refi/__snapshots__/jsfmt.spec.js.snap b/tests/refi/__snapshots__/jsfmt.spec.js.snap index 2c362b855..f925c3e2a 100644 --- a/tests/refi/__snapshots__/jsfmt.spec.js.snap +++ b/tests/refi/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test bound.js 1`] = ` "// refinements of bound vars (closed-over locals) // should have the same lifetimes as heap objects. -var x : ?string = \"xxx\"; +var x : ?string = "xxx"; var tests = [ @@ -38,7 +38,7 @@ var tests = // requires further remedial work in Env function() { if (x != null) { - alert(\"\"); + alert(""); var y : string = x; // not ok } }, @@ -56,11 +56,11 @@ var tests = }, function() { - var y : string = x != null ? x : \"\"; // ok + var y : string = x != null ? x : ""; // ok }, function() { - var y : string = x || \"\"; // ok + var y : string = x || ""; // ok }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -75,7 +75,7 @@ var tests = // requires further remedial work in Env function() { if (x != null) { - alert(\"\"); + alert(""); var y : string = x; // not ok } }, @@ -84,7 +84,7 @@ var tests = // not ok // ok // ok -var x: ?string = \"xxx\"; +var x: ?string = "xxx"; var tests = [ function() { var y: string = x; @@ -127,10 +127,10 @@ var tests = [ } }, function() { - var y: string = (x != null ? x : \"\"); + var y: string = (x != null ? x : ""); }, function() { - var y: string = x || \"\"; + var y: string = x || ""; } ]; " @@ -140,48 +140,48 @@ exports[`test heap.js 1`] = ` "var tests = [ function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; var y : string = x.p; // not ok }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p != null) { var y : string = x.p; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p == null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p == null) return; var y : string = x.p; // ok }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (!(x.p != null)) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p != null) { - alert(\"\"); + alert(""); var y : string = x.p; // not ok } }, function () { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p != null) { x.p = null; var y : string = x.p; // not ok @@ -189,13 +189,13 @@ exports[`test heap.js 1`] = ` }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p != null) {} var y : string = x.p; // not ok }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p != null) { } else { var y : string = x.p; // not ok @@ -203,17 +203,17 @@ exports[`test heap.js 1`] = ` }, function() { - var x : {p:?string} = {p:\"xxx\"}; - var y : string = x.p != null ? x.p : \"\"; // ok + var x : {p:?string} = {p:"xxx"}; + var y : string = x.p != null ? x.p : ""; // ok }, function() { - var x : {p:?string} = {p:\"xxx\"}; - var y : string = x.p || \"\"; // ok + var x : {p:?string} = {p:"xxx"}; + var y : string = x.p || ""; // ok }, function() { - var x : {p:string | string[]} = {p:[\"xxx\"]}; + var x : {p:string | string[]} = {p:["xxx"]}; if (Array.isArray(x.p)) { var y : string[] = x.p; // ok } else { @@ -224,7 +224,7 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; if (!x.y) { - x.y = \"foo\"; + x.y = "foo"; } (x.y: string); }, @@ -233,7 +233,7 @@ exports[`test heap.js 1`] = ` var x : {y: ?string} = {y: null}; if (x.y) { } else { - x.y = \"foo\"; + x.y = "foo"; } (x.y: string); }, @@ -249,27 +249,27 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; if (x.y) { - x.y = \"foo\"; + x.y = "foo"; } else { - x.y = \"bar\"; + x.y = "bar"; } (x.y : string); }, function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == \"number\") { - x.y = \"foo\"; + if (typeof x.y == "number") { + x.y = "foo"; } (x.y : string); // error, could also be boolean }, function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == \"number\") { - x.y = \"foo\"; - } else if (typeof x.y == \"boolean\") { - x.y = \"bar\"; + if (typeof x.y == "number") { + x.y = "foo"; + } else if (typeof x.y == "boolean") { + x.y = "bar"; } (x.y : boolean); // error, string }, @@ -277,7 +277,7 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; if (!x.y) { - x.y = \"foo\"; + x.y = "foo"; } if (x.y) { x.y = null; @@ -287,11 +287,11 @@ exports[`test heap.js 1`] = ` function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == \"number\") { - x.y = \"foo\"; + if (typeof x.y == "number") { + x.y = "foo"; } // now x.y can is string | boolean - if (typeof x.y == \"string\") { + if (typeof x.y == "string") { x.y = false; } // now x.y is only boolean @@ -300,11 +300,11 @@ exports[`test heap.js 1`] = ` function() { var x : {y: string | number | boolean} = {y: false}; - if (typeof x.y == \"number\") { - x.y = \"foo\"; + if (typeof x.y == "number") { + x.y = "foo"; } // now x.y can is string | boolean - if (typeof x.y == \"string\") { + if (typeof x.y == "string") { x.y = 123; } // now x.y is number | boolean @@ -313,7 +313,7 @@ exports[`test heap.js 1`] = ` function() { var x : {y: ?string} = {y: null}; - var z : string = \"foo\"; + var z : string = "foo"; if (x.y) { x.y = z; } else { @@ -323,12 +323,12 @@ exports[`test heap.js 1`] = ` }, function(x: string) { - if (x === \'a\') {} - (x: \'b\'); // error (but only once, string !~> \'b\'; \'a\' is irrelevant) + if (x === 'a') {} + (x: 'b'); // error (but only once, string !~> 'b'; 'a' is irrelevant) }, function(x: mixed) { - if (typeof x.bar === \'string\') {} // error, so \`x.bar\` refinement is empty + if (typeof x.bar === 'string') {} // error, so \`x.bar\` refinement is empty (x: string & number); }, @@ -343,7 +343,7 @@ exports[`test heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { if (false) {} - x.foo = \"foo\"; + x.foo = "foo"; } (x.foo: string); }, @@ -352,7 +352,7 @@ exports[`test heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { while(false) {} - x.foo = \"foo\"; + x.foo = "foo"; } (x.foo: string); }, @@ -361,13 +361,13 @@ exports[`test heap.js 1`] = ` let x: { foo: ?string } = { foo: null }; if (!x.foo) { for (var i = 0; i < 0; i++) {} - x.foo = \"foo\"; + x.foo = "foo"; } (x.foo: string); }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p != null) { var {p} = x; // TODO: annot checked against type of x (p : string); // ok @@ -399,7 +399,7 @@ exports[`test heap.js 1`] = ` // now x.y can is string | boolean // now x.y is number | boolean // error -// error (but only once, string !~> \'b\'; \'a\' is irrelevant) +// error (but only once, string !~> 'b'; 'a' is irrelevant) // error, so \`x.bar\` refinement is empty // --- nested conditionals --- // after a branch, the current scope may have changed. this causes the @@ -411,17 +411,17 @@ exports[`test heap.js 1`] = ` // ok var tests = [ function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; var y: string = x.p; }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p != null) { var y: string = x.p; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p == null) { } else { @@ -429,13 +429,13 @@ var tests = [ } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p == null) return; var y: string = x.p; }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (!(x.p != null)) { } else { @@ -443,28 +443,28 @@ var tests = [ } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p != null) { - alert(\"\"); + alert(""); var y: string = x.p; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p != null) { x.p = null; var y: string = x.p; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p != null) { } var y: string = x.p; }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p != null) { } else { @@ -472,15 +472,15 @@ var tests = [ } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; - var y: string = (x.p != null ? x.p : \"\"); + var x: { p: ?string } = { p: "xxx" }; + var y: string = (x.p != null ? x.p : ""); }, function() { - var x: { p: ?string } = { p: \"xxx\" }; - var y: string = x.p || \"\"; + var x: { p: ?string } = { p: "xxx" }; + var y: string = x.p || ""; }, function() { - var x: { p: string | string[] } = { p: [ \"xxx\" ] }; + var x: { p: string | string[] } = { p: [ "xxx" ] }; if (Array.isArray(x.p)) { var y: string[] = x.p; } else { @@ -490,7 +490,7 @@ var tests = [ function() { var x: { y: ?string } = { y: null }; if (!x.y) { - x.y = \"foo\"; + x.y = "foo"; } (x.y: string); }, @@ -499,7 +499,7 @@ var tests = [ if (x.y) { } else { - x.y = \"foo\"; + x.y = "foo"; } (x.y: string); }, @@ -513,33 +513,33 @@ var tests = [ function() { var x: { y: ?string } = { y: null }; if (x.y) { - x.y = \"foo\"; + x.y = "foo"; } else { - x.y = \"bar\"; + x.y = "bar"; } (x.y: string); }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == \"number\") { - x.y = \"foo\"; + if (typeof x.y == "number") { + x.y = "foo"; } (x.y: string); }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == \"number\") { - x.y = \"foo\"; + if (typeof x.y == "number") { + x.y = "foo"; } else - if (typeof x.y == \"boolean\") { - x.y = \"bar\"; + if (typeof x.y == "boolean") { + x.y = "bar"; } (x.y: boolean); }, function() { var x: { y: ?string } = { y: null }; if (!x.y) { - x.y = \"foo\"; + x.y = "foo"; } if (x.y) { x.y = null; @@ -548,27 +548,27 @@ var tests = [ }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == \"number\") { - x.y = \"foo\"; + if (typeof x.y == "number") { + x.y = "foo"; } - if (typeof x.y == \"string\") { + if (typeof x.y == "string") { x.y = false; } (x.y: string); }, function() { var x: { y: string | number | boolean } = { y: false }; - if (typeof x.y == \"number\") { - x.y = \"foo\"; + if (typeof x.y == "number") { + x.y = "foo"; } - if (typeof x.y == \"string\") { + if (typeof x.y == "string") { x.y = 123; } (x.y: string); }, function() { var x: { y: ?string } = { y: null }; - var z: string = \"foo\"; + var z: string = "foo"; if (x.y) { x.y = z; } else { @@ -577,13 +577,13 @@ var tests = [ (x.y: string); }, function(x: string) { - if (x === \"a\") { + if (x === "a") { } - (x: \"b\"); + (x: "b"); }, function(x: mixed) { - if (typeof x.bar === \"string\") { + if (typeof x.bar === "string") { } (x: string & number); @@ -594,7 +594,7 @@ var tests = [ if (false) { } - x.foo = \"foo\"; + x.foo = "foo"; } (x.foo: string); }, @@ -604,7 +604,7 @@ var tests = [ while (false) { } - x.foo = \"foo\"; + x.foo = "foo"; } (x.foo: string); }, @@ -614,12 +614,12 @@ var tests = [ for (var i = 0; i < 0; i++) { } - x.foo = \"foo\"; + x.foo = "foo"; } (x.foo: string); }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p != null) { var { p } = x; (p: string); @@ -633,7 +633,7 @@ exports[`test lex.js 1`] = ` "function block_scope(x: string | number) { { let x; - x = \"\"; // doesn\'t refine outer x + x = ""; // doesn't refine outer x } (x : string); // error: number ~> string } @@ -642,7 +642,7 @@ function switch_scope(x: string | number) { switch (x) { default: let x; - x = \"\"; // doesn\'t refine outer x + x = ""; // doesn't refine outer x } (x : string); // error: number ~> string } @@ -650,37 +650,37 @@ function switch_scope(x: string | number) { function try_scope(x: string | number) { try { let x; - x = \"\"; // doesn\'t refine outer x + x = ""; // doesn't refine outer x } catch (e) { - x = \"\"; // refinement would only escape if both sides refined + x = ""; // refinement would only escape if both sides refined } (x : string); // error: number ~> string } function try_scope_catch(x: string | number) { try { - x = \"\"; // refinement would only escape if both sides refined + x = ""; // refinement would only escape if both sides refined } catch (e) { let x; - x = \"\"; // doesn\'t refine outer x + x = ""; // doesn't refine outer x } (x : string); // error: number ~> string } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// doesn\'t refine outer x +// doesn't refine outer x // error: number ~> string -// doesn\'t refine outer x +// doesn't refine outer x // error: number ~> string -// doesn\'t refine outer x +// doesn't refine outer x // refinement would only escape if both sides refined // error: number ~> string // refinement would only escape if both sides refined -// doesn\'t refine outer x +// doesn't refine outer x // error: number ~> string function block_scope(x: string | number) { { let x; - x = \"\"; + x = ""; } (x: string); } @@ -688,25 +688,25 @@ function switch_scope(x: string | number) { switch (x) { default: let x; - x = \"\"; + x = ""; } (x: string); } function try_scope(x: string | number) { try { let x; - x = \"\"; + x = ""; } catch (e) { - x = \"\"; + x = ""; } (x: string); } function try_scope_catch(x: string | number) { try { - x = \"\"; + x = ""; } catch (e) { let x; - x = \"\"; + x = ""; } (x: string); } @@ -717,54 +717,54 @@ exports[`test local.js 1`] = ` "var paths = [ function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; var y : string = x; // not ok }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x != null) { var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x == null) {} else { var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x == null) return; var y : string = x; // ok }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (!(x != null)) {} else { var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x != null) { - alert(\"\"); + alert(""); var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x != null) {} var y : string = x; // not ok }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x != null) { } else { var y : string = x; // not ok @@ -772,17 +772,17 @@ exports[`test local.js 1`] = ` }, function() { - var x : ?string = \"xxx\"; - var y : string = x != null ? x : \"\"; // ok + var x : ?string = "xxx"; + var y : string = x != null ? x : ""; // ok }, function() { - var x : ?string = \"xxx\"; - var y : string = x || \"\"; // ok + var x : ?string = "xxx"; + var y : string = x || ""; // ok }, function() { - var x : string | string[] = [\"xxx\"]; + var x : string | string[] = ["xxx"]; if (Array.isArray(x)) { var y : string[] = x; // ok } else { @@ -793,7 +793,7 @@ exports[`test local.js 1`] = ` function() { var x : ?string = null; if (!x) { - x = \"xxx\"; + x = "xxx"; } var y : string = x; }, @@ -813,17 +813,17 @@ exports[`test local.js 1`] = ` // ok var paths = [ function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; var y: string = x; }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x != null) { var y: string = x; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x == null) { } else { @@ -831,13 +831,13 @@ var paths = [ } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x == null) return; var y: string = x; }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (!(x != null)) { } else { @@ -845,21 +845,21 @@ var paths = [ } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x != null) { - alert(\"\"); + alert(""); var y: string = x; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x != null) { } var y: string = x; }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x != null) { } else { @@ -867,15 +867,15 @@ var paths = [ } }, function() { - var x: ?string = \"xxx\"; - var y: string = (x != null ? x : \"\"); + var x: ?string = "xxx"; + var y: string = (x != null ? x : ""); }, function() { - var x: ?string = \"xxx\"; - var y: string = x || \"\"; + var x: ?string = "xxx"; + var y: string = x || ""; }, function() { - var x: string | string[] = [ \"xxx\" ]; + var x: string | string[] = [ "xxx" ]; if (Array.isArray(x)) { var y: string[] = x; } else { @@ -885,7 +885,7 @@ var paths = [ function() { var x: ?string = null; if (!x) { - x = \"xxx\"; + x = "xxx"; } var y: string = x; } @@ -898,28 +898,28 @@ exports[`test null_tests.js 1`] = ` [ // expr != null function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x != null) { var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (null != x) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p != null) { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q != null) { var y : string = x.p.q; // ok } @@ -927,21 +927,21 @@ exports[`test null_tests.js 1`] = ` // expr == null function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x == null) {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p == null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q == null) {} else { var y : string = x.p.q; // ok } @@ -949,21 +949,21 @@ exports[`test null_tests.js 1`] = ` // expr !== null function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x !== null) { var y : string | void = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p !== null) { var y : string | void = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q !== null) { var y : string | void = x.p.q; // ok } @@ -971,21 +971,21 @@ exports[`test null_tests.js 1`] = ` // expr === null function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x === null) {} else { var y : string | void = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p === null) {} else { var y : string | void = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q === null) {} else { var y : string | void = x.p.q; // ok } @@ -1000,12 +1000,12 @@ class C { if (this.p != null) return this.p; else - return \"\"; + return ""; } ensure1(): string { if (this.p == null) - return \"\"; + return ""; return this.p; } @@ -1013,12 +1013,12 @@ class C { if (this.p !== null) return this.p; else - return \"\"; + return ""; } ensure3(): string | void { if (this.p === null) - return \"\"; + return ""; return this.p; } } @@ -1030,22 +1030,22 @@ class D extends C { if (super.p != null) return super.p; else - return \"\"; + return ""; } ensure101(): string { if (super.p == null) - return \"\"; + return ""; else return super.p; } ensure103(): string { if (super.p != null) { - alert(\"\"); + alert(""); return super.p; // not ok } - return \"\"; + return ""; } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1071,31 +1071,31 @@ class D extends C { // not ok var null_tests = [ function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x != null) { var y: string = x; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (null != x) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p != null) { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q != null) { var y: string = x.p.q; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x == null) { } else { @@ -1103,7 +1103,7 @@ var null_tests = [ } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p == null) { } else { @@ -1111,7 +1111,7 @@ var null_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q == null) { } else { @@ -1119,25 +1119,25 @@ var null_tests = [ } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x !== null) { var y: string | void = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p !== null) { var y: string | void = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q !== null) { var y: string | void = x.p.q; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x === null) { } else { @@ -1145,7 +1145,7 @@ var null_tests = [ } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p === null) { } else { @@ -1153,7 +1153,7 @@ var null_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q === null) { } else { @@ -1167,22 +1167,22 @@ class C { if (this.p != null) return this.p; else - return \"\"; + return ""; } ensure1(): string { if (this.p == null) - return \"\"; + return ""; return this.p; } ensure2(): string | void { if (this.p !== null) return this.p; else - return \"\"; + return ""; } ensure3(): string | void { if (this.p === null) - return \"\"; + return ""; return this.p; } } @@ -1191,20 +1191,20 @@ class D extends C { if (super.p != null) return super.p; else - return \"\"; + return ""; } ensure101(): string { if (super.p == null) - return \"\"; + return ""; else return super.p; } ensure103(): string { if (super.p != null) { - alert(\"\"); + alert(""); return super.p; } - return \"\"; + return ""; } } " @@ -1232,7 +1232,7 @@ function exhaustion1(x): number { foo = 3; break; default: - throw new Error(\'Invalid state\'); + throw new Error('Invalid state'); } return foo; // no error } @@ -1245,19 +1245,19 @@ function exhaustion2(x, y): number { break; // leaks uninitialized foo out of switch } /** - * TODO this shouldn\'t cause an error, because the path that + * TODO this shouldn't cause an error, because the path that * runs it will always go on to assign a number to foo. But - * we\'ll need true isolation in env snapshots to model this. - * Currently tvars are always shared between clones - we\'d + * we'll need true isolation in env snapshots to model this. + * Currently tvars are always shared between clones - we'd * have to rework envs pretty extensively to avoid it. * - foo = \"\"; + foo = ""; */ case 1: foo = 3; break; default: - throw new Error(\'Invalid state\'); + throw new Error('Invalid state'); } return foo; // error, possibly uninitialized } @@ -1270,7 +1270,7 @@ function exhaustion3(x): number { foo = 3; break; default: - throw new Error(\'Invalid state\'); + throw new Error('Invalid state'); } return foo; // no error } @@ -1283,13 +1283,13 @@ function exhaustion3(x): number { // no error // leaks uninitialized foo out of switch /** - * TODO this shouldn\'t cause an error, because the path that + * TODO this shouldn't cause an error, because the path that * runs it will always go on to assign a number to foo. But - * we\'ll need true isolation in env snapshots to model this. - * Currently tvars are always shared between clones - we\'d + * we'll need true isolation in env snapshots to model this. + * Currently tvars are always shared between clones - we'd * have to rework envs pretty extensively to avoid it. * - foo = \"\"; + foo = ""; */ // error, possibly uninitialized // falls through @@ -1311,7 +1311,7 @@ function exhaustion1(x): number { foo = 3; break; default: - throw new Error(\"Invalid state\"); + throw new Error("Invalid state"); } return foo; } @@ -1326,7 +1326,7 @@ function exhaustion2(x, y): number { foo = 3; break; default: - throw new Error(\"Invalid state\"); + throw new Error("Invalid state"); } return foo; } @@ -1338,7 +1338,7 @@ function exhaustion3(x): number { foo = 3; break; default: - throw new Error(\"Invalid state\"); + throw new Error("Invalid state"); } return foo; } @@ -1350,95 +1350,95 @@ exports[`test typeof_tests.js 1`] = ` [ // typeof expr == typename function() { - var x : ?string = \"xxx\"; - if (typeof x == \"string\") { + var x : ?string = "xxx"; + if (typeof x == "string") { var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; - if (\"string\" == typeof x) { + var x : ?string = "xxx"; + if ("string" == typeof x) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; - if (typeof x.p == \"string\") { + var x : {p:?string} = {p:"xxx"}; + if (typeof x.p == "string") { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; - if (typeof x.p.q == \"string\") { + var x : {p:{q:?string}} = {p:{q:"xxx"}}; + if (typeof x.p.q == "string") { var y : string = x.p.q; // ok } }, // typeof expr != typename function() { - var x : ?string = \"xxx\"; - if (typeof x != \"string\") {} else { + var x : ?string = "xxx"; + if (typeof x != "string") {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; - if (typeof x.p != \"string\") {} else { + var x : {p:?string} = {p:"xxx"}; + if (typeof x.p != "string") {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; - if (typeof x.p.q != \"string\") {} else { + var x : {p:{q:?string}} = {p:{q:"xxx"}}; + if (typeof x.p.q != "string") {} else { var y : string = x.p.q; // ok } }, // typeof expr === typename function() { - var x : ?string = \"xxx\"; - if (typeof x === \"string\") { + var x : ?string = "xxx"; + if (typeof x === "string") { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; - if (typeof x.p === \"string\") { + var x : {p:?string} = {p:"xxx"}; + if (typeof x.p === "string") { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; - if (typeof x.p.q === \"string\") { + var x : {p:{q:?string}} = {p:{q:"xxx"}}; + if (typeof x.p.q === "string") { var y : string = x.p.q; // ok } }, // typeof expr !== typename function() { - var x : ?string = \"xxx\"; - if (typeof x !== \"string\") {} else { + var x : ?string = "xxx"; + if (typeof x !== "string") {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; - if (typeof x.p !== \"string\") {} else { + var x : {p:?string} = {p:"xxx"}; + if (typeof x.p !== "string") {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; - if (typeof x.p.q !== \"string\") {} else { + var x : {p:{q:?string}} = {p:{q:"xxx"}}; + if (typeof x.p.q !== "string") {} else { var y : string = x.p.q; // ok } }, @@ -1449,29 +1449,29 @@ class A { p: ?string; ensure0(): string { - if (typeof this.p == \"string\") + if (typeof this.p == "string") return this.p; else - return \"\"; + return ""; } ensure1(): string { - if (typeof this.p != \"string\") - return \"\"; + if (typeof this.p != "string") + return ""; else return this.p; } ensure2(): string | void { - if (typeof this.p === \"string\") + if (typeof this.p === "string") return this.p; else - return \"\"; + return ""; } ensure3(): string | void { - if (typeof this.p !== \"string\") - return \"\"; + if (typeof this.p !== "string") + return ""; else return this.p; } @@ -1497,90 +1497,90 @@ class A { // typeof this.p op typename var null_tests = [ function() { - var x: ?string = \"xxx\"; - if (typeof x == \"string\") { + var x: ?string = "xxx"; + if (typeof x == "string") { var y: string = x; } }, function() { - var x: ?string = \"xxx\"; - if (\"string\" == typeof x) { + var x: ?string = "xxx"; + if ("string" == typeof x) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; - if (typeof x.p == \"string\") { + var x: { p: ?string } = { p: "xxx" }; + if (typeof x.p == "string") { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; - if (typeof x.p.q == \"string\") { + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + if (typeof x.p.q == "string") { var y: string = x.p.q; } }, function() { - var x: ?string = \"xxx\"; - if (typeof x != \"string\") { + var x: ?string = "xxx"; + if (typeof x != "string") { } else { var y: string = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; - if (typeof x.p != \"string\") { + var x: { p: ?string } = { p: "xxx" }; + if (typeof x.p != "string") { } else { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; - if (typeof x.p.q != \"string\") { + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + if (typeof x.p.q != "string") { } else { var y: string = x.p.q; } }, function() { - var x: ?string = \"xxx\"; - if (typeof x === \"string\") { + var x: ?string = "xxx"; + if (typeof x === "string") { var y: string = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; - if (typeof x.p === \"string\") { + var x: { p: ?string } = { p: "xxx" }; + if (typeof x.p === "string") { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; - if (typeof x.p.q === \"string\") { + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + if (typeof x.p.q === "string") { var y: string = x.p.q; } }, function() { - var x: ?string = \"xxx\"; - if (typeof x !== \"string\") { + var x: ?string = "xxx"; + if (typeof x !== "string") { } else { var y: string = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; - if (typeof x.p !== \"string\") { + var x: { p: ?string } = { p: "xxx" }; + if (typeof x.p !== "string") { } else { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; - if (typeof x.p.q !== \"string\") { + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; + if (typeof x.p.q !== "string") { } else { var y: string = x.p.q; @@ -1590,26 +1590,26 @@ var null_tests = [ class A { p: ?string; ensure0(): string { - if (typeof this.p == \"string\") + if (typeof this.p == "string") return this.p; else - return \"\"; + return ""; } ensure1(): string { - if (typeof this.p != \"string\") - return \"\"; + if (typeof this.p != "string") + return ""; else return this.p; } ensure2(): string | void { - if (typeof this.p === \"string\") + if (typeof this.p === "string") return this.p; else - return \"\"; + return ""; } ensure3(): string | void { - if (typeof this.p !== \"string\") - return \"\"; + if (typeof this.p !== "string") + return ""; else return this.p; } @@ -1624,28 +1624,28 @@ exports[`test undef_tests.js 1`] = ` // expr !== undefined function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x !== undefined && x !== null) { var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (undefined !== x && x !== null) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p !== undefined && x.p !== null) { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q !== undefined && x.p.q !== null) { var y : string = x.p.q; // ok } @@ -1653,21 +1653,21 @@ exports[`test undef_tests.js 1`] = ` // expr === undefined function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x === undefined || x === null) {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p === undefined || x.p === null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q === undefined || x.p.q === null) {} else { var y : string = x.p.q; // ok } @@ -1682,12 +1682,12 @@ class A { if (this.p !== undefined && this.p !== null) return this.p; else - return \"\"; + return ""; } ensure1(): string { if (this.p === undefined || this.p === null) - return \"\"; + return ""; else return this.p; } @@ -1706,31 +1706,31 @@ class A { // this.p op undefined var undef_tests = [ function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x !== undefined && x !== null) { var y: string = x; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (undefined !== x && x !== null) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p !== undefined && x.p !== null) { var y: string = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q !== undefined && x.p.q !== null) { var y: string = x.p.q; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x === undefined || x === null) { } else { @@ -1738,7 +1738,7 @@ var undef_tests = [ } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p === undefined || x.p === null) { } else { @@ -1746,7 +1746,7 @@ var undef_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q === undefined || x.p.q === null) { } else { @@ -1760,11 +1760,11 @@ class A { if (this.p !== undefined && this.p !== null) return this.p; else - return \"\"; + return ""; } ensure1(): string { if (this.p === undefined || this.p === null) - return \"\"; + return ""; else return this.p; } @@ -1779,28 +1779,28 @@ exports[`test void_tests.js 1`] = ` // expr !== void(...) function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x !== void(0) && x !== null) { var y : string = x; // ok } }, function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (void(0) !== x && x !== null) { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p !== void(0) && x.p !== null) { var y : string | void = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q !== void(0) && x.p.q !== null) { var y : string = x.p.q; // ok } @@ -1808,21 +1808,21 @@ exports[`test void_tests.js 1`] = ` // expr === void(...) function() { - var x : ?string = \"xxx\"; + var x : ?string = "xxx"; if (x === void(0) || x === null) {} else { var y : string = x; // ok } }, function() { - var x : {p:?string} = {p:\"xxx\"}; + var x : {p:?string} = {p:"xxx"}; if (x.p === void(0) || x.p === null) {} else { var y : string = x.p; // ok } }, function() { - var x : {p:{q:?string}} = {p:{q:\"xxx\"}}; + var x : {p:{q:?string}} = {p:{q:"xxx"}}; if (x.p.q === void(0) || x.p.q === null) {} else { var y : string = x.p.q; // ok } @@ -1837,12 +1837,12 @@ class A { if (this.p !== void(0) && this.p !== null) return this.p; else - return \"\"; + return ""; } ensure1(): string { if (this.p === void(0) || this.p === null) - return \"\"; + return ""; else return this.p; } @@ -1861,31 +1861,31 @@ class A { // this.p op void(...) var void_tests = [ function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x !== void 0 && x !== null) { var y: string = x; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (void 0 !== x && x !== null) { var y: string = x; } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p !== void 0 && x.p !== null) { var y: string | void = x.p; } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q !== void 0 && x.p.q !== null) { var y: string = x.p.q; } }, function() { - var x: ?string = \"xxx\"; + var x: ?string = "xxx"; if (x === void 0 || x === null) { } else { @@ -1893,7 +1893,7 @@ var void_tests = [ } }, function() { - var x: { p: ?string } = { p: \"xxx\" }; + var x: { p: ?string } = { p: "xxx" }; if (x.p === void 0 || x.p === null) { } else { @@ -1901,7 +1901,7 @@ var void_tests = [ } }, function() { - var x: { p: { q: ?string } } = { p: { q: \"xxx\" } }; + var x: { p: { q: ?string } } = { p: { q: "xxx" } }; if (x.p.q === void 0 || x.p.q === null) { } else { @@ -1915,11 +1915,11 @@ class A { if (this.p !== void 0 && this.p !== null) return this.p; else - return \"\"; + return ""; } ensure1(): string { if (this.p === void 0 || this.p === null) - return \"\"; + return ""; else return this.p; } diff --git a/tests/refinements/__snapshots__/jsfmt.spec.js.snap b/tests/refinements/__snapshots__/jsfmt.spec.js.snap index 4233e44e5..c1205d0e2 100644 --- a/tests/refinements/__snapshots__/jsfmt.spec.js.snap +++ b/tests/refinements/__snapshots__/jsfmt.spec.js.snap @@ -41,7 +41,7 @@ function foo(x: ?number) { var z = y * 1000; } } -type Bar = { parent: ?Bar, doStuff: : () => void }; +type Bar = { parent: ?Bar; doStuff(): void }; function bar0(x: Bar) { while (x = x.parent) { x.doStuff(); @@ -74,8 +74,8 @@ type Node2 = { export type ASTNode = Node1 | Node2; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -type Node1 = { kind: \"Node1\", prop1?: string }; -type Node2 = { kind: \"Node2\", prop2?: string }; +type Node1 = { kind: \"Node1\"; prop1?: string }; +type Node2 = { kind: \"Node2\"; prop2?: string }; export type ASTNode = Node1 | Node2; " `; @@ -158,13 +158,13 @@ function baz(x: ?boolean) { } } let tests = [ - function(x: { done: true, result: string } | { done: false }) { + function(x: { done: true; result: string } | { done: false }) { if (x.done === true) { return x.result; } return x.result; }, - function(x: { done: true, result: string } | { done: false }) { + function(x: { done: true; result: string } | { done: false }) { if (true === x.done) { return x.result; } @@ -280,9 +280,9 @@ let tests = [ // error, consider { baz: \"x\", quux: \"y\", bar: \"boom\" } // error, consider { foo: {}, bar: \"\" } type Type = Name | ListType | NonNullType; -type Name = { kind: \"Name\", value: string, type: void }; -type ListType = { kind: \"ListType\", type: Type }; -type NonNullType = { kind: \"NonNullType\", type: Name | ListType | BadType }; +type Name = { kind: \"Name\"; value: string; type: void }; +type ListType = { kind: \"ListType\"; type: Type }; +type NonNullType = { kind: \"NonNullType\"; type: Name | ListType | BadType }; type BadType = {}; function getTypeASTName(typeAST: Type): string { if (!typeAST.type) @@ -290,20 +290,20 @@ function getTypeASTName(typeAST: Type): string { return getTypeASTName(typeAST.type); } let tests = [ - function(x: { done: true, result: string } | { done: false }) { + function(x: { done: true; result: string } | { done: false }) { if (x.done) { return x.result; } return x.result; }, - function(x: { done: true, result: string } | { foo: string }) { + function(x: { done: true; result: string } | { foo: string }) { if (x.done) { return x.result; } return x.result; }, function() { - type T = { foo: Object, bar: string } | { baz: string, quux: string }; + type T = { foo: Object; bar: string } | { baz: string; quux: string }; function testAlwaysTruthyProp(t: T) { if (t.foo) { (t.bar: string); @@ -490,7 +490,7 @@ function bar(x:Object) { // treated as \`any\`, so allowed // still treated as \`any\`, so allowed // also treated as \`any\`, so allowed -function foo(x: { y?: : () => void }) { +function foo(x: { y?(): void }) { x.y(); if (x.hasOwnProperty(\"y\")) { x.y(); @@ -708,7 +708,7 @@ exports[`test lib.js 1`] = ` declare var BAZ: {stuff?: (x: number) => void} | void; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -declare var BAZ: { stuff?: : (x: number) => void } | void; +declare var BAZ: { stuff?(x: number): void } | void; " `; @@ -1432,7 +1432,7 @@ let tests = [ } return x.foo; }, - function(x: { kind: 0, foo: number } | { kind: 1, bar: number }): number { + function(x: { kind: 0; foo: number } | { kind: 1; bar: number }): number { if (x.kind === 0) { return x.foo; } else { @@ -1635,7 +1635,7 @@ function c2(x: { [key: string]: ?string }, y: { z: string }): string { return \"\"; } function c3( - x: { [key: string]: ?string }, y: { z: string, a: string } + x: { [key: string]: ?string }, y: { z: string; a: string } ): string { if (x[y.z]) { y.a = \"HEY\"; @@ -2013,7 +2013,7 @@ let tests = [ return x.foo; }, function( - x: { kind: \"foo\", foo: string } | { kind: \"bar\", bar: string } + x: { kind: \"foo\"; foo: string } | { kind: \"bar\"; bar: string } ): string { if (x.kind === \"foo\") { return x.foo; @@ -2556,8 +2556,8 @@ let tests = [ // error: flow isn\'t smart enough to figure this out yet // error type Type = Name | ListType; -type Name = { kind: \"Name\", value: string }; -type ListType = { kind: \"ListType\", name: string }; +type Name = { kind: \"Name\"; value: string }; +type ListType = { kind: \"ListType\"; name: string }; function getTypeASTName(typeAST: Type): string { if (typeAST.kind === \"Name\") { return typeAST.value; @@ -2573,10 +2573,10 @@ function foo(x: ASTNode) { } return null; } -type Apple = { kind: \"Fruit\", taste: \"Bad\" }; -type Orange = { kind: \"Fruit\", taste: \"Good\" }; -type Broccoli = { kind: \"Veg\", taste: \"Bad\", raw: \"No\" }; -type Carrot = { kind: \"Veg\", taste: \"Good\", raw: \"Maybe\" }; +type Apple = { kind: \"Fruit\"; taste: \"Bad\" }; +type Orange = { kind: \"Fruit\"; taste: \"Good\" }; +type Broccoli = { kind: \"Veg\"; taste: \"Bad\"; raw: \"No\" }; +type Carrot = { kind: \"Veg\"; taste: \"Good\"; raw: \"Maybe\" }; type Breakfast = Apple | Orange | Broccoli | Carrot; function bar(x: Breakfast) { if (x.kind === \"Fruit\") { @@ -2608,9 +2608,9 @@ function check(n) { return true; } var EnumKind = { A: 1, B: 2, C: 3 }; -type A = { kind: 1, A: number }; -type B = { kind: 2, B: number }; -type C = { kind: 3, C: number }; +type A = { kind: 1; A: number }; +type B = { kind: 2; B: number }; +type C = { kind: 3; C: number }; function kind(x: A | B | C): number { switch (x.kind) { case EnumKind.A: @@ -2623,7 +2623,7 @@ function kind(x: A | B | C): number { } kind({ kind: EnumKind.A, A: 1 }); type Citizen = { citizen: true }; -type NonCitizen = { citizen: false, nationality: string }; +type NonCitizen = { citizen: false; nationality: string }; function nationality(x: Citizen | NonCitizen) { if (x.citizen) return \"Shire\"; @@ -2705,7 +2705,7 @@ let tests = [ (t.calll: empty); } }, - function(x: { str: string, num: number, bool: boolean }) { + function(x: { str: string; num: number; bool: boolean }) { if (x.str === \"str\") { (x.str: \"not str\"); } @@ -2725,7 +2725,7 @@ let tests = [ (x.badBool: empty); } }, - function(x: { foo: 123, y: string } | { foo: \"foo\", z: string }) { + function(x: { foo: 123; y: string } | { foo: \"foo\"; z: string }) { if (x.foo === 123) { (x.y: string); x.z; @@ -2741,7 +2741,7 @@ let tests = [ x.z; } }, - function(x: { foo: number, y: string } | { foo: \"foo\", z: string }) { + function(x: { foo: number; y: string } | { foo: \"foo\"; z: string }) { if (x.foo === 123) { (x.y: string); x.z; @@ -2757,7 +2757,7 @@ let tests = [ x.z; } }, - function(x: { foo: number, y: string } | { foo: string, z: string }) { + function(x: { foo: number; y: string } | { foo: string; z: string }) { if (x.foo === 123) { (x.y: string); x.z; @@ -2774,7 +2774,7 @@ let tests = [ } }, function( - x: { foo: number, y: string } | { foo: string, z: string }, num: number + x: { foo: number; y: string } | { foo: string; z: string }, num: number ) { if (x.foo === num) { x.y; @@ -2812,8 +2812,8 @@ function handleStatus(status: Success | Error) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ import { SUCCESS, ERROR } from \"./constants\"; -type Success = { type: typeof SUCCESS, message: string }; -type Error = { type: typeof ERROR, error: string }; +type Success = { type: typeof SUCCESS; message: string }; +type Error = { type: typeof ERROR; error: string }; function handleStatus(status: Success | Error) { switch (status.type) { case SUCCESS: diff --git a/tests/regexp/__snapshots__/jsfmt.spec.js.snap b/tests/regexp/__snapshots__/jsfmt.spec.js.snap index 8c701b1bf..9a05a5354 100644 --- a/tests/regexp/__snapshots__/jsfmt.spec.js.snap +++ b/tests/regexp/__snapshots__/jsfmt.spec.js.snap @@ -1,8 +1,8 @@ exports[`test regexp.js 1`] = ` "var patt=/Hello/g -var match:number = patt.test(\"Hello world!\"); +var match:number = patt.test("Hello world!"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var patt = /Hello/g; -var match: number = patt.test(\"Hello world!\"); +var match: number = patt.test("Hello world!"); " `; diff --git a/tests/replace/__snapshots__/jsfmt.spec.js.snap b/tests/replace/__snapshots__/jsfmt.spec.js.snap index 3fb9ae381..df7ef9b32 100644 --- a/tests/replace/__snapshots__/jsfmt.spec.js.snap +++ b/tests/replace/__snapshots__/jsfmt.spec.js.snap @@ -3,12 +3,12 @@ exports[`test test.js 1`] = ` function foo(x) { } -foo(\"\"); +foo(""); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var a = 0; function foo(x) { } -foo(\"\"); +foo(""); " `; diff --git a/tests/require/__snapshots__/jsfmt.spec.js.snap b/tests/require/__snapshots__/jsfmt.spec.js.snap index 76293e5b8..d5b6d030c 100644 --- a/tests/require/__snapshots__/jsfmt.spec.js.snap +++ b/tests/require/__snapshots__/jsfmt.spec.js.snap @@ -26,14 +26,14 @@ module.exports = { numberValue: 42 }; -exports = {stringValue: \'\'}; +exports = {stringValue: ''}; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Local \`exports\` var is just a ref to module.exports, so mutating the original // value will affect the exports object but re-binding it makes it useless and // does not affect the exports value. module.exports = { numberValue: 42 }; -exports = { stringValue: \"\" }; +exports = { stringValue: "" }; " `; @@ -71,13 +71,13 @@ exports[`test not_builtin_require.js 1`] = ` "// @flow function require() {} -require(\"not a module name\"); +require("not a module name"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow function require() { } -require(\"not a module name\"); +require("not a module name"); " `; @@ -100,35 +100,35 @@ function takesANumber(num: number): void {} function takesAString(str: string): void {} // @providesModule -var A = require(\"A\"); +var A = require("A"); takesANumber(A.numberValue); takesAString(A.numberValue); // File path -var B = require(\"./B\"); +var B = require("./B"); takesANumber(B.numberValue); takesAString(B.numberValue); // C.js exists, but not as a providesModule -require(\"C\"); +require("C"); // @providesModule D exists, but not as a filename -require(\"./D\"); +require("./D"); // E exports an object with a numVal property -var E = require(\'./E\'); +var E = require('./E'); var e_1: number = E.numberValue; -E.stringValue; // Error: The E exports obj has no \'stringValue\' property +E.stringValue; // Error: The E exports obj has no 'stringValue' property // We require that the param passed to require() be a string literal to support // guaranteed static extraction -var a = \'./E\'; +var a = './E'; require(a); // Error: Param must be string literal require(\`./E\`); // template literals are ok... -require(\`\${\'./E\'}\`); // error: but only if they have no expressions +require(\`\${'./E'}\`); // error: but only if they have no expressions -// require.call is allowed but circumverts Flow\'s static analysis -require.call(null, \"DoesNotExist\"); +// require.call is allowed but circumverts Flow's static analysis +require.call(null, "DoesNotExist"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // @providesModule @@ -136,34 +136,34 @@ require.call(null, \"DoesNotExist\"); // C.js exists, but not as a providesModule // @providesModule D exists, but not as a filename // E exports an object with a numVal property -// Error: The E exports obj has no \'stringValue\' property +// Error: The E exports obj has no 'stringValue' property // We require that the param passed to require() be a string literal to support // guaranteed static extraction // Error: Param must be string literal // template literals are ok... // error: but only if they have no expressions -// require.call is allowed but circumverts Flow\'s static analysis +// require.call is allowed but circumverts Flow's static analysis function takesANumber(num: number): void { } function takesAString(str: string): void { } -var A = require(\"A\"); +var A = require("A"); takesANumber(A.numberValue); takesAString(A.numberValue); -var B = require(\"./B\"); +var B = require("./B"); takesANumber(B.numberValue); takesAString(B.numberValue); -require(\"C\"); -require(\"./D\"); -var E = require(\"./E\"); +require("C"); +require("./D"); +var E = require("./E"); var e_1: number = E.numberValue; E.stringValue; -var a = \"./E\"; +var a = "./E"; require(a); require(\`./E\`); -require(\`\${\"./E\"}\`); -require.call(null, \"DoesNotExist\"); +require(\`\${"./E"}\`); +require.call(null, "DoesNotExist"); " `; diff --git a/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap b/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap index be377ae39..6fc24e56d 100644 --- a/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap +++ b/tests/requireLazy/__snapshots__/jsfmt.spec.js.snap @@ -6,14 +6,14 @@ exports[`test A.js 1`] = ` module.exports = { numberValueA: 1, - stringValueA: \"someString\" + stringValueA: "someString" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule A * @flow */ -module.exports = { numberValueA: 1, stringValueA: \"someString\" }; +module.exports = { numberValueA: 1, stringValueA: "someString" }; " `; @@ -25,14 +25,14 @@ exports[`test B.js 1`] = ` module.exports = { numberValueB: 1, - stringValueB: \"someString\" + stringValueB: "someString" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @providesModule B * @flow */ -module.exports = { numberValueB: 1, stringValueB: \"someString\" }; +module.exports = { numberValueB: 1, stringValueB: "someString" }; " `; @@ -41,7 +41,7 @@ exports[`test requireLazy.js 1`] = ` * @flow */ -requireLazy([\'A\', \'B\'], function(A, B) { +requireLazy(['A', 'B'], function(A, B) { var num1: number = A.numberValueA; var str1: string = A.stringValueA; var num2: number = A.stringValueA; // Error: string ~> number @@ -58,7 +58,7 @@ var notB: Object = B; requireLazy(); // Error: No args requireLazy([nope], function() {}); // Error: Non-stringliteral args -requireLazy([\'A\']); // Error: No calback expression +requireLazy(['A']); // Error: No calback expression ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -71,7 +71,7 @@ requireLazy([\'A\']); // Error: No calback expression // Error: Non-stringliteral args // Error: No calback expression requireLazy( - [ \"A\", \"B\" ], + [ "A", "B" ], function(A, B) { var num1: number = A.numberValueA; var str1: string = A.stringValueA; @@ -92,6 +92,6 @@ requireLazy( } ); -requireLazy([ \"A\" ]); +requireLazy([ "A" ]); " `; diff --git a/tests/return/__snapshots__/jsfmt.spec.js.snap b/tests/return/__snapshots__/jsfmt.spec.js.snap index 1d07dd800..4bc758e34 100644 --- a/tests/return/__snapshots__/jsfmt.spec.js.snap +++ b/tests/return/__snapshots__/jsfmt.spec.js.snap @@ -83,7 +83,7 @@ function f(b) { if (b) { return undefined; } else { - return \"nope\"; + return "nope"; } } @@ -97,7 +97,7 @@ function f(b) { if (b) { return undefined; } else { - return \"nope\"; + return "nope"; } } (f(true): void); diff --git a/tests/return_new/__snapshots__/jsfmt.spec.js.snap b/tests/return_new/__snapshots__/jsfmt.spec.js.snap index 9e11c24be..8912c4880 100644 --- a/tests/return_new/__snapshots__/jsfmt.spec.js.snap +++ b/tests/return_new/__snapshots__/jsfmt.spec.js.snap @@ -43,7 +43,7 @@ exports[`test test2.js 1`] = ` } var d = new D(); -d.x = \"\"; // error, string ~/~ number (but property x is found) +d.x = ""; // error, string ~/~ number (but property x is found) (new D: D); // error, new D is an object, D not in proto chain @@ -52,9 +52,9 @@ module.exports = D; // OK // error, string ~/~ number (but property x is found) // error, new D is an object, D not in proto chain -declare class D { constructor: : () => { x: number }, y: any } +declare class D { constructor(): { x: number }; y: any } var d = new D(); -d.x = \"\"; +d.x = ""; (new D(): D); module.exports = D; " diff --git a/tests/sealed/__snapshots__/jsfmt.spec.js.snap b/tests/sealed/__snapshots__/jsfmt.spec.js.snap index 95f2e9397..f29abf6e5 100644 --- a/tests/sealed/__snapshots__/jsfmt.spec.js.snap +++ b/tests/sealed/__snapshots__/jsfmt.spec.js.snap @@ -31,7 +31,7 @@ var x:number = o.x; Foo.prototype.m = function() { return this.x; } var y:number = o.m(); -o.x = \"...\"; +o.x = "..."; Foo.prototype = { m: function() { return false; } } @@ -49,7 +49,7 @@ Foo.prototype.m = function() { return this.x; }; var y: number = o.m(); -o.x = \"...\"; +o.x = "..."; Foo.prototype = { m: function() { return false; @@ -61,26 +61,26 @@ module.exports = export_o; `; exports[`test sealed.js 1`] = ` -"var o = require(\'./proto\'); +"var o = require('./proto'); o.z = 0; var x:string = o.x; -var Bar = require(\'./function\'); +var Bar = require('./function'); var a = new Bar(234); a.x = 123; -a.y = \'abc\'; // error, needs to be declared in Bar\'s constructor +a.y = 'abc'; // error, needs to be declared in Bar's constructor (a.getX(): number); (a.getY(): string); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// error, needs to be declared in Bar\'s constructor -var o = require(\"./proto\"); +// error, needs to be declared in Bar's constructor +var o = require("./proto"); o.z = 0; var x: string = o.x; -var Bar = require(\"./function\"); +var Bar = require("./function"); var a = new Bar(234); a.x = 123; -a.y = \"abc\"; +a.y = "abc"; (a.getX(): number); (a.getY(): string); " diff --git a/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap b/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap index 3e77de11c..902d0d6af 100644 --- a/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap +++ b/tests/sealed_objects/__snapshots__/jsfmt.spec.js.snap @@ -3,13 +3,13 @@ exports[`test test.js 1`] = ` var s1: string = o1.y; // error var o2: { x: number; y?: string; } = { x: 0 }; -var s2: string = o2.y || \"\"; // ok +var s2: string = o2.y || ""; // ok var o3: { x: number; y?: string; } = ({ x: 0, y: 0 }: { x: number; }); -var s3: string = o3.y || \"\"; // error +var s3: string = o3.y || ""; // error var o4: { x: number; y?: string; } = ({ x: 0 }: { x: number; [_:any]:any}); -var s4: string = o4.y || \"\"; // ok +var s4: string = o4.y || ""; // ok var o5 = { x: 0, ...{} }; var s5: string = o5.y; // ok (spreads make object types extensible) @@ -28,18 +28,18 @@ var o7: { x: number; y?: string; } = ({ x: 0, y: 0 }: { x: number; [_:any]:numbe // error var o1 = { x: 0 }; var s1: string = o1.y; -var o2: { x: number, y?: string } = { x: 0 }; -var s2: string = o2.y || \"\"; -var o3: { x: number, y?: string } = ({ x: 0, y: 0 }: { x: number }); -var s3: string = o3.y || \"\"; -var o4: { x: number, y?: string } = ({ x: 0 }: { [_: any]: any, x: number }); -var s4: string = o4.y || \"\"; +var o2: { x: number; y?: string } = { x: 0 }; +var s2: string = o2.y || ""; +var o3: { x: number; y?: string } = ({ x: 0, y: 0 }: { x: number }); +var s3: string = o3.y || ""; +var o4: { x: number; y?: string } = ({ x: 0 }: { [_: any]: any; x: number }); +var s4: string = o4.y || ""; var o5 = { x: 0, ...{} }; var s5: string = o5.y; -var o6: { [_: any]: any, x: number } = { x: 0 }; +var o6: { [_: any]: any; x: number } = { x: 0 }; var s6: string = o6.y; -var o7: { x: number, y?: string } = ({ x: 0, y: 0 }: { - [_: any]: number, +var o7: { x: number; y?: string } = ({ x: 0, y: 0 }: { + [_: any]: number; x: number }); " diff --git a/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap b/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap index a452a1333..c006a945f 100644 --- a/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap +++ b/tests/simple_arrays/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test array.js 1`] = ` var a = []; for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } - else { a[i] = \'\'; }; + else { a[i] = ''; }; } // \`i\` never gets a lower bound, so the array access is stalled until the @@ -33,7 +33,7 @@ for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } else { - a[i] = \"\"; + a[i] = ""; } } function foo(i): string { @@ -54,7 +54,7 @@ exports[`test array2.js 1`] = ` var a = []; for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } - else { a[i] = \'\'; }; + else { a[i] = ''; }; } function foo(i: number): string { return a[i]; } @@ -65,7 +65,7 @@ for (var i = 0; i < 10; ++i) { if (i % 2 == 0) { a[i] = 0; } else { - a[i] = \"\"; + a[i] = ""; } } function foo(i: number): string { diff --git a/tests/spread/__snapshots__/jsfmt.spec.js.snap b/tests/spread/__snapshots__/jsfmt.spec.js.snap index 4fe5a3b63..39775bdf4 100644 --- a/tests/spread/__snapshots__/jsfmt.spec.js.snap +++ b/tests/spread/__snapshots__/jsfmt.spec.js.snap @@ -37,16 +37,16 @@ function parseCounter(line: string): number { return 0; } function parseGroup(lines: Array): { - counter: number, - begin: number, - end: number, + counter: number; + begin: number; + end: number; text: string } { var counter = parseCounter(lines[0]); var timeframe = parseTimeframe(lines[1]); return { counter, ...timeframe, text: lines[2] }; } -function parseTimeframe(line: string): { begin: number, end: number } { +function parseTimeframe(line: string): { begin: number; end: number } { var timestamps = line.split(\"-->\"); return { begin: parseTimestamp(timestamps[0].trim()), @@ -161,9 +161,8 @@ function test( * result is a new object. */ // OK -declare function map(obj: { - [key: string]: Tv -}, iterator: (obj: Tv) => TNext): Array; +declare function map(obj: { [key: string]: Tv }, +iterator: (obj: Tv) => TNext): Array; function test(x: { kind: ?string }, kinds: { [key: string]: string }): Array<{ kind: ?string }> { @@ -205,9 +204,9 @@ var o = { foo: \"bar\" }; o = { ...o }; (o: { foo: string }); var p = { foo: \"bar\" }; -(p: { foo: string, abc: string }); +(p: { foo: string; abc: string }); p = { ...p, abc: \"def\" }; -(p: { foo: string, abc: string }); +(p: { foo: string; abc: string }); var q = { foo: \"bar\" }; for (var i = 0; i < 10; i++) { q = { ...q }; diff --git a/tests/static_overload/lib/__snapshots__/jsfmt.spec.js.snap b/tests/static_overload/lib/__snapshots__/jsfmt.spec.js.snap index cbc2ab43e..8ecadb2d4 100644 --- a/tests/static_overload/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/static_overload/lib/__snapshots__/jsfmt.spec.js.snap @@ -5,8 +5,8 @@ exports[`test lib.js 1`] = ` } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ declare class StaticOverload { - foo: : (x: number) => number, - foo: : (x: string) => string + static foo(x: number): number; + static foo(x: string): string } " `; diff --git a/tests/strict/__snapshots__/jsfmt.spec.js.snap b/tests/strict/__snapshots__/jsfmt.spec.js.snap index fdc437efc..2dbc5cc33 100644 --- a/tests/strict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/strict/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,5 @@ exports[`test annot.js 1`] = ` -"var A = require(\'./unknown_class\'); +"var A = require('./unknown_class'); class B extends A { foo(x:A):A { return x; } @@ -9,7 +9,7 @@ class B extends A { module.exports = B; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -var A = require(\"./unknown_class\"); +var A = require("./unknown_class"); class B extends A { foo(x: A): A { return x; diff --git a/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap b/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap index c7ecb582c..ddec54c1b 100644 --- a/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap +++ b/tests/strict_requires/__snapshots__/jsfmt.spec.js.snap @@ -9,36 +9,36 @@ module.exports = 0; exports[`test B.js 1`] = ` "/* @flow */ -module.exports = { foo: \"\" } +module.exports = { foo: "" } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -module.exports = { foo: \"\" }; +module.exports = { foo: "" }; " `; exports[`test C.js 1`] = ` "/* @flow */ var o = { - A: require(\'./A\'), - ...require(\'./B\'), + A: require('./A'), + ...require('./B'), }; module.exports = o; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var o = { A: require(\"./A\"), ...require(\"./B\") }; +var o = { A: require("./A"), ...require("./B") }; module.exports = o; " `; exports[`test D.js 1`] = ` "/* @flow */ -var C = require(\'./C\'); +var C = require('./C'); var x: number = C.foo; var y: string = C.A; C.A = false; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var C = require(\"./C\"); +var C = require("./C"); var x: number = C.foo; var y: string = C.A; C.A = false; diff --git a/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap b/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap index 3dab50506..c5a8e7cb6 100644 --- a/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap +++ b/tests/structural_subtyping/__snapshots__/jsfmt.spec.js.snap @@ -8,18 +8,18 @@ interface IHasLength { } var lengthTest1: IHasLength = []; -var lengthTest2: IHasLength = \'hello\'; -var lengthTest3: IHasLength = 123; // number doesn\'t have length -var lengthTest4: IHasLength = true; // bool doesn\'t have length +var lengthTest2: IHasLength = 'hello'; +var lengthTest3: IHasLength = 123; // number doesn't have length +var lengthTest4: IHasLength = true; // bool doesn't have length ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ -// number doesn\'t have length -// bool doesn\'t have length -interface IHasLength extends { length: number } +// number doesn't have length +// bool doesn't have length +interface IHasLength { length: number } var lengthTest1: IHasLength = [ ]; -var lengthTest2: IHasLength = \"hello\"; +var lengthTest2: IHasLength = "hello"; var lengthTest3: IHasLength = 123; var lengthTest4: IHasLength = true; " @@ -58,9 +58,9 @@ var testInstance3: IHasYString = new ClassWithXString(); // Error missing prop class ClassWithXString { x: string; } -interface IHasXString extends { x: string } -interface IHasXNumber extends { x: number } -interface IHasYString extends { y: string } +interface IHasXString { x: string } +interface IHasXNumber { x: number } +interface IHasYString { y: string } var testInstance1: IHasXString = new ClassWithXString(); var testInstance2: IHasXNumber = new ClassWithXString(); var testInstance3: IHasYString = new ClassWithXString(); @@ -76,7 +76,7 @@ interface IHasXString { x: string; } -var propTest1: IHasXString = { x: \'hello\' }; +var propTest1: IHasXString = { x: 'hello' }; var propTest2: IHasXString = { x: 123 }; // Error string != number var propTest3: IHasXString = {}; // Property not found var propTest4: IHasXString = ({}: Object); @@ -96,8 +96,8 @@ function propTest6(y: {[key: string]: number}) { // Property not found // OK // error: string != number -interface IHasXString extends { x: string } -var propTest1: IHasXString = { x: \"hello\" }; +interface IHasXString { x: string } +var propTest1: IHasXString = { x: "hello" }; var propTest2: IHasXString = { x: 123 }; var propTest3: IHasXString = {}; var propTest4: IHasXString = ({}: Object); @@ -118,18 +118,18 @@ interface HasOptional { b?: number, }; -var test1: HasOptional = { a: \"hello\" } +var test1: HasOptional = { a: "hello" } var test2: HasOptional = {}; // Error: missing property a -var test3: HasOptional = { a: \"hello\", b: true }; // Error: boolean ~> number +var test3: HasOptional = { a: "hello", b: true }; // Error: boolean ~> number ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Error: missing property a // Error: boolean ~> number -interface HasOptional extends { a: string, b?: number } -var test1: HasOptional = { a: \"hello\" }; +interface HasOptional { a: string; b?: number } +var test1: HasOptional = { a: "hello" }; var test2: HasOptional = {}; -var test3: HasOptional = { a: \"hello\", b: true }; +var test3: HasOptional = { a: "hello", b: true }; " `; diff --git a/tests/suppress/__snapshots__/jsfmt.spec.js.snap b/tests/suppress/__snapshots__/jsfmt.spec.js.snap index bfb65e39a..07e37d74b 100644 --- a/tests/suppress/__snapshots__/jsfmt.spec.js.snap +++ b/tests/suppress/__snapshots__/jsfmt.spec.js.snap @@ -16,7 +16,7 @@ var test3: string = getNum(); // This error should be suppressed var test4: string = 123; // This error is NOT suppressed - // $FlowFixMe Indentation shouldn\'t matter + // $FlowFixMe Indentation shouldn't matter var test5: string = 123; // This error should be suppressed /* @@ -32,7 +32,7 @@ var test6: string = 123; // This error should be suppressed // $FlowFixMe Error unused suppression // This error is NOT suppressed -// $FlowFixMe Indentation shouldn\'t matter +// $FlowFixMe Indentation shouldn't matter // This error should be suppressed /* * $FlowNewLine diff --git a/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap b/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap index ade0d0ba8..db6b1cf02 100644 --- a/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap +++ b/tests/suppress_traces/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`test traces.js 1`] = ` "/* * The location marked with the FlowFixMe does not show up in the original * error but shows up in the flow check --traces 10 result. This test makes - * sure that we don\'t suppress the error due to a location that only shows up + * sure that we don't suppress the error due to a location that only shows up * when --traces is turned on. */ @@ -13,12 +13,12 @@ function foo(x: string) { return bar(); } -var a: string = foo(\'hi\'); // error number ~> string +var a: string = foo('hi'); // error number ~> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* * The location marked with the FlowFixMe does not show up in the original * error but shows up in the flow check --traces 10 result. This test makes - * sure that we don\'t suppress the error due to a location that only shows up + * sure that we don't suppress the error due to a location that only shows up * when --traces is turned on. */ // $FlowFixMe - Error unused suppression @@ -29,6 +29,6 @@ function bar(): number { function foo(x: string) { return bar(); } -var a: string = foo(\"hi\"); +var a: string = foo("hi"); " `; diff --git a/tests/switch/__snapshots__/jsfmt.spec.js.snap b/tests/switch/__snapshots__/jsfmt.spec.js.snap index 64116faaf..98b169936 100644 --- a/tests/switch/__snapshots__/jsfmt.spec.js.snap +++ b/tests/switch/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ function foo(x): number { switch (x) { case 0: case 1: return 1; - default: throw new Error(\'hi\'); + default: throw new Error('hi'); } } @@ -21,7 +21,7 @@ function baz(x): number { switch (x) { case 0: break; case 1: return 1; - default: throw new Error(\'hi\'); + default: throw new Error('hi'); } return 2; } @@ -33,7 +33,7 @@ function foo(x): number { case 1: return 1; default: - throw new Error(\"hi\"); + throw new Error("hi"); } } function bar(x) { @@ -52,7 +52,7 @@ function baz(x): number { case 1: return 1; default: - throw new Error(\"hi\"); + throw new Error("hi"); } return 2; } @@ -65,16 +65,16 @@ exports[`test switch.js 1`] = ` */ function foo( ): number { - switch (\'foo\') { - case \'foo\': + switch ('foo') { + case 'foo': return 1; } return 2; } function bar() { - switch (\'bar\') { - case \'bar\': + switch ('bar') { + case 'bar': break; default: break; @@ -82,11 +82,11 @@ function bar() { } function qux(b) { - var x = b? 0: \"\"; - switch(\'qux\') { - case \'\': + var x = b? 0: ""; + switch('qux') { + case '': x = 0; - case \'qux\': + case 'qux': x = x*x; } } @@ -95,26 +95,26 @@ function qux(b) { * @flow */ function foo(): number { - switch (\"foo\") { - case \"foo\": + switch ("foo") { + case "foo": return 1; } return 2; } function bar() { - switch (\"bar\") { - case \"bar\": + switch ("bar") { + case "bar": break; default: break; } } function qux(b) { - var x = (b ? 0 : \"\"); - switch (\"qux\") { - case \"\": + var x = (b ? 0 : ""); + switch ("qux") { + case "": x = 0; - case \"qux\": + case "qux": x = x * x; } } @@ -126,11 +126,11 @@ exports[`test switch_default_fallthrough.js 1`] = ` * @flow */ function foo(x : mixed): string { - var a = \"\"; - var b = \"\"; + var a = ""; + var b = ""; switch (x) { - case \"foo\": + case "foo": a = 0; default: b = 0; @@ -146,15 +146,15 @@ function foo(x : mixed): string { } function baz(x: mixed): number { - var a = \"\"; - var b = \"\"; + var a = ""; + var b = ""; switch (x) { - case \"baz\": + case "baz": a = 0; break; - case \"bar\": - a = \"\"; + case "bar": + a = ""; default: b = 0; } @@ -187,10 +187,10 @@ function baz(x: mixed): number { // error, string | number ~/> number // error, string ~/> number function foo(x: mixed): string { - var a = \"\"; - var b = \"\"; + var a = ""; + var b = ""; switch (x) { - case \"foo\": + case "foo": a = 0; default: b = 0; @@ -201,14 +201,14 @@ function foo(x: mixed): string { return b; } function baz(x: mixed): number { - var a = \"\"; - var b = \"\"; + var a = ""; + var b = ""; switch (x) { - case \"baz\": + case "baz": a = 0; break; - case \"bar\": - a = \"\"; + case "bar": + a = ""; default: b = 0; } @@ -240,7 +240,7 @@ function f1(i) { x = -1; break; case 2: - x = \"2\"; + x = "2"; break; } @@ -281,7 +281,7 @@ function f3(i) { function foo(x): number { switch (x) { case 0: - default: throw new Error(\'hi\'); + default: throw new Error('hi'); case 1: return 1; } } @@ -297,7 +297,7 @@ function bar(x) { function baz(x): number { switch (x) { case 0: break; - default: throw new Error(\'hi\'); + default: throw new Error('hi'); case 1: return 1; } return 2; @@ -325,7 +325,7 @@ function f1(i) { x = -1; break; case 2: - x = \"2\"; + x = "2"; break; } var y: number = x; @@ -357,7 +357,7 @@ function foo(x): number { switch (x) { case 0: default: - throw new Error(\"hi\"); + throw new Error("hi"); case 1: return 1; } @@ -376,7 +376,7 @@ function baz(x): number { case 0: break; default: - throw new Error(\"hi\"); + throw new Error("hi"); case 1: return 1; } diff --git a/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap b/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap index 8d630c4bd..426fd25f0 100644 --- a/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap +++ b/tests/tagged-unions/__snapshots__/jsfmt.spec.js.snap @@ -89,7 +89,7 @@ if (data.kind === "user") { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -interface IDataBase extends { id: string, name: string } +interface IDataBase { id: string; name: string } interface IUserData extends IDataBase { kind: "user" } interface ISystemData extends IDataBase { kind: "system" } type IData = IUserData | ISystemData; @@ -129,7 +129,7 @@ if (data.kind === "system") { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -interface IDataBase extends { id: string, name: string } +interface IDataBase { id: string; name: string } interface IUserData extends IDataBase { kind: "user" } interface ISystemData extends IDataBase { kind: "system" } type IData = IUserData | ISystemData; @@ -173,9 +173,9 @@ if (data.kind === "user") { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type DataBase = { id: string, name: string }; -type UserData = { id: string, name: string, kind: "user" }; -type SystemData = { id: string, name: string, kind: "system" }; +type DataBase = { id: string; name: string }; +type UserData = { id: string; name: string; kind: "user" }; +type SystemData = { id: string; name: string; kind: "system" }; type Data = UserData | SystemData; const data: Data = { id: "", name: "", kind: "system" }; if (data.kind === "user") { @@ -217,9 +217,9 @@ if (data.kind === "system") { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type DataBase = { id: string, name: string }; -type UserData = { id: string, name: string, kind: "user" }; -type SystemData = { id: string, name: string, kind: "system" }; +type DataBase = { id: string; name: string }; +type UserData = { id: string; name: string; kind: "user" }; +type SystemData = { id: string; name: string; kind: "system" }; type Data = UserData | SystemData; const data: Data = { id: "", name: "", kind: "system" }; if (data.kind === "system") { diff --git a/tests/taint/__snapshots__/jsfmt.spec.js.snap b/tests/taint/__snapshots__/jsfmt.spec.js.snap index cb670efa7..ccef2a129 100644 --- a/tests/taint/__snapshots__/jsfmt.spec.js.snap +++ b/tests/taint/__snapshots__/jsfmt.spec.js.snap @@ -77,7 +77,7 @@ let tests = [ // getting a property function() { - let obj: Object = { foo: \'foo\' }; + let obj: Object = { foo: 'foo' }; (obj.foo: $Tainted); // ok }, @@ -107,7 +107,7 @@ let tests = [ obj[y] = x; }, function() { - let obj: Object = { foo: \"foo\" }; + let obj: Object = { foo: "foo" }; (obj.foo: $Tainted); }, function(x: $Tainted) { @@ -153,13 +153,13 @@ function f_foo3(f1 : Function, o1 : Object, o2 : {t : $Tainted}) { function foo(x: $Tainted, o: Object) { o.f(x); } -function foo1(x: $Tainted, o: { f: : (y: $Tainted) => void }) { +function foo1(x: $Tainted, o: { f(y: $Tainted): void }) { o.f(x); } function foo2(o1: Object, o2: { t: $Tainted }) { o1.f(o2.t); } -function foo3(x: $Tainted, o: { f: : (y: $Tainted) => void }) { +function foo3(x: $Tainted, o: { f(y: $Tainted): void }) { o.f(x); } function f_foo1(x: $Tainted, f: Function) { @@ -291,7 +291,7 @@ declare function doStuff(x: $Tainted): void; declare var fakeDocument: FakeDocument; declare var fakeLocation: FakeLocation; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare class FakeLocation { assign: : (url: string) => void } +declare class FakeLocation { assign(url: string): void } declare class FakeDocument { location: FakeLocation } declare function doStuff(x: $Tainted): void; declare var fakeDocument: FakeDocument; @@ -306,7 +306,7 @@ exports[`test taint1.js 1`] = ` */ class A { f(tainted : $Tainted) { - // This shouldn\'t give a warning (both are tainted) + // This shouldn't give a warning (both are tainted) var also_tainted : $Tainted = tainted; } } @@ -315,7 +315,7 @@ class A { * * @flow */ -// This shouldn\'t give a warning (both are tainted) +// This shouldn't give a warning (both are tainted) class A { f(tainted: $Tainted) { var also_tainted: $Tainted = tainted; @@ -384,7 +384,7 @@ exports[`test taint4.js 1`] = ` * @flow */ -var safe : string = \"safe\"; +var safe : string = "safe"; // This should be allowed. var tainted : $Tainted = safe @@ -399,7 +399,7 @@ function f(x : $Tainted) { */ // This should be allowed. // Should cause error. -var safe: string = \"safe\"; +var safe: string = "safe"; var tainted: $Tainted = safe; function f(x: $Tainted) { var y: any = x; @@ -455,7 +455,7 @@ function foo(x: $Tainted) { function foo1(x: $Tainted<{ f: number }>) { var ok: number = x.f; } -function foo2(o: { f: : (y: number) => number }, t: $Tainted) { +function foo2(o: { f(y: number): number }, t: $Tainted) { return o.f(t); } function foo3(x: $Tainted<{ f: number }>) { diff --git a/tests/template/__snapshots__/jsfmt.spec.js.snap b/tests/template/__snapshots__/jsfmt.spec.js.snap index e7ff9907e..3a3db6016 100644 --- a/tests/template/__snapshots__/jsfmt.spec.js.snap +++ b/tests/template/__snapshots__/jsfmt.spec.js.snap @@ -2,32 +2,32 @@ exports[`test template.js 1`] = ` "/* @flow */ (\`foo\`: string); // ok -(\`bar\`: \'bar\'); // ok +(\`bar\`: 'bar'); // ok (\`baz\`: number); // error \`foo \${123} bar\`; // ok, number can be appended to string -\`foo \${{bar: 123}} baz\`; // error, object can\'t be appended +\`foo \${{bar: 123}} baz\`; // error, object can't be appended let tests = [ function(x: string) { \`foo \${x}\`; // ok \`\${x} bar\`; // ok - \`foo \${\'bar\'} \${x}\`; // ok + \`foo \${'bar'} \${x}\`; // ok }, function(x: number) { \`foo \${x}\`; // ok \`\${x} bar\`; // ok - \`foo \${\'bar\'} \${x}\`; // ok + \`foo \${'bar'} \${x}\`; // ok }, function(x: boolean) { \`foo \${x}\`; // error \`\${x} bar\`; // error - \`foo \${\'bar\'} \${x}\`; // error + \`foo \${'bar'} \${x}\`; // error }, function(x: mixed) { \`foo \${x}\`; // error \`\${x} bar\`; // error - \`foo \${\'bar\'} \${x}\`; // error + \`foo \${'bar'} \${x}\`; // error }, ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -36,7 +36,7 @@ let tests = [ // ok // error // ok, number can be appended to string -// error, object can\'t be appended +// error, object can't be appended // ok // ok // ok @@ -50,7 +50,7 @@ let tests = [ // error // error (\`foo\`: string); -(\`bar\`: \"bar\"); +(\`bar\`: "bar"); (\`baz\`: number); \`foo \${123} bar\`; \`foo \${{ bar: 123 }} baz\`; @@ -58,22 +58,22 @@ let tests = [ function(x: string) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${\"bar\"} \${x}\`; + \`foo \${"bar"} \${x}\`; }, function(x: number) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${\"bar\"} \${x}\`; + \`foo \${"bar"} \${x}\`; }, function(x: boolean) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${\"bar\"} \${x}\`; + \`foo \${"bar"} \${x}\`; }, function(x: mixed) { \`foo \${x}\`; \`\${x} bar\`; - \`foo \${\"bar\"} \${x}\`; + \`foo \${"bar"} \${x}\`; } ]; " diff --git a/tests/this/__snapshots__/jsfmt.spec.js.snap b/tests/this/__snapshots__/jsfmt.spec.js.snap index 3de350253..92ba158e1 100644 --- a/tests/this/__snapshots__/jsfmt.spec.js.snap +++ b/tests/this/__snapshots__/jsfmt.spec.js.snap @@ -7,17 +7,17 @@ F.prototype.m = function() { this.y = 0; } function foo(p:string) { } var o1 = new F(); // sets o1.x to 0 -o1.x = \"\"; +o1.x = ""; foo(o1.x); // ok by definite assignment var o2 = new F(); o1.y = 0; -o2.y = \"\"; +o2.y = ""; foo(o2.y); // setting o1.y to 0 has no effect on o2.y var o3 = new F(); o3.m(); // sets o3.y to 0 -o3.y = \"\"; +o3.y = ""; foo(o3.y); // ok by definite assignment foo(o2.y); // setting o3.y to 0 has no effect on o2.y @@ -32,7 +32,7 @@ function f1() : number { var f1_1 = f1.bind({x: 0})(); // ok var f1_2 : string = f1.bind({x: 0})(); // error, number -> string -var f1_3 = f1.bind({x: \"\"})(); // error, string -> number +var f1_3 = f1.bind({x: ""})(); // error, string -> number // TODO make this error blame the call site, rather than the function body var f1_4 = f1(); // error, (global object).x @@ -52,7 +52,7 @@ function f2() : number { var f2_1 = f2.bind({x: 0})(); // ok var f2_2 : string = f2.bind({x: 0})(); // error, number -> string -var f2_3 = f2.bind({x: \"\"})(); // error, string -> number +var f2_3 = f2.bind({x: ""})(); // error, string -> number // TODO make this error blame the call site, rather than the function body var f2_4 = f2(); // error, (global object).x @@ -95,15 +95,15 @@ function foo(p: string) { } var o1 = new F(); -o1.x = \"\"; +o1.x = ""; foo(o1.x); var o2 = new F(); o1.y = 0; -o2.y = \"\"; +o2.y = ""; foo(o2.y); var o3 = new F(); o3.m(); -o3.y = \"\"; +o3.y = ""; foo(o3.y); foo(o2.y); function f1(): number { @@ -111,7 +111,7 @@ function f1(): number { } var f1_1 = f1.bind({ x: 0 })(); var f1_2: string = f1.bind({ x: 0 })(); -var f1_3 = f1.bind({ x: \"\" })(); +var f1_3 = f1.bind({ x: "" })(); var f1_4 = f1(); var a1 = () => { return this.x; @@ -125,7 +125,7 @@ function f2(): number { } var f2_1 = f2.bind({ x: 0 })(); var f2_2: string = f2.bind({ x: 0 })(); -var f2_3 = f2.bind({ x: \"\" })(); +var f2_3 = f2.bind({ x: "" })(); var f2_4 = f2(); (this: void); module.exports = true; @@ -156,7 +156,7 @@ class E { class F extends E { foo() { // OK to override with generalization (() => { - super.foo(\"\"); // find super method, error due to incorrect arg + super.foo(""); // find super method, error due to incorrect arg })(); } } @@ -196,7 +196,7 @@ class E { class F extends E { foo() { (() => { - super.foo(\"\"); + super.foo(""); })(); } } diff --git a/tests/this_type/__snapshots__/jsfmt.spec.js.snap b/tests/this_type/__snapshots__/jsfmt.spec.js.snap index a4d5b7204..3f9b18910 100644 --- a/tests/this_type/__snapshots__/jsfmt.spec.js.snap +++ b/tests/this_type/__snapshots__/jsfmt.spec.js.snap @@ -34,7 +34,7 @@ var d = new D(); (d.next: D); // sneaky class A { - foo(that: X) { } // error: can\'t hide contravariance using a bound + foo(that: X) { } // error: can't hide contravariance using a bound } class B extends A { @@ -79,7 +79,7 @@ class Misc { // error (see below for exploit): \`this\` should only appear in // covariant positions // sneaky -// error: can\'t hide contravariance using a bound +// error: can't hide contravariance using a bound // error (see above, catches hidden override) // covariance checks on this type in invariant positions // covariance checks on this type as type args @@ -213,9 +213,9 @@ class ImplicitNumber extends Implicit { exports[`test import.js 1`] = ` "// Check that imports are handled properly with this types -import { A1 } from \'./export\'; -import type { A2 } from \'./export\'; -import { A3 } from \'./export\'; +import { A1 } from './export'; +import type { A2 } from './export'; +import { A3 } from './export'; class B1 extends A1 { foo(): B1 { return new B1(); } // error @@ -243,9 +243,9 @@ class B3 extends A3 { // OK // error // error -import { A1 } from \"./export\"; -import type { A2 } from \"./export\"; -import { A3 } from \"./export\"; +import { A1 } from "./export"; +import type { A2 } from "./export"; +import { A3 } from "./export"; class B1 extends A1 { foo(): B1 { return new B1(); @@ -275,8 +275,8 @@ class C { function foo(c: C): I { return c; } function bar(c: C): J { return c; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -interface I extends { xs: Array } -interface J extends { f: : () => J } +interface I { xs: Array } +interface J { f(): J } class C { xs: Array; f(): C { @@ -296,21 +296,21 @@ exports[`test lib_client.js 1`] = ` "(new DoublyLinkedList().prev(): DoublyLinkedList); (new DoublyLinkedList().next(): DoublyLinkedList) -var MiniImmutable = require(\"mini-immutable\"); +var MiniImmutable = require("mini-immutable"); class C { map: MiniImmutable.OrderedMap; update() { - this.map = this.map.set(0,\"\"); + this.map = this.map.set(0,""); } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (new DoublyLinkedList().prev(): DoublyLinkedList); (new DoublyLinkedList().next(): DoublyLinkedList); -var MiniImmutable = require(\"mini-immutable\"); +var MiniImmutable = require("mini-immutable"); class C { map: MiniImmutable.OrderedMap; update() { - this.map = this.map.set(0, \"\"); + this.map = this.map.set(0, ""); } } " @@ -321,13 +321,13 @@ exports[`test self.js 1`] = ` foo() { return this; } // return of foo is not annotated to get around // substituting this below bar(): this { return new A().foo(); } // same as returning : A, so error - qux(): this { return this.bar(); } // OK (don\'t cascade errors) + qux(): this { return this.bar(); } // OK (don't cascade errors) } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // return of foo is not annotated to get around // substituting this below // same as returning : A, so error -// OK (don\'t cascade errors) +// OK (don't cascade errors) class A { foo() { return this; diff --git a/tests/this_type/lib/__snapshots__/jsfmt.spec.js.snap b/tests/this_type/lib/__snapshots__/jsfmt.spec.js.snap index 927f24365..fee1db7aa 100644 --- a/tests/this_type/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/this_type/lib/__snapshots__/jsfmt.spec.js.snap @@ -10,7 +10,7 @@ declare class DoublyLinkedList extends LinkedList { prev(): this; } -declare module "mini-immutable" { +declare module \"mini-immutable\" { declare class Map { set(key: K, value: V): this; // more precise than Map (see below) } @@ -24,11 +24,11 @@ declare module "mini-immutable" { // is disabled for perf reasons, these will produce warnings. /* more precise than Map (see below)*/ /* inherits set method returning OrderedMap instead of Map*/ -declare class LinkedList { next: : () => this } -declare class DoublyLinkedList { prev: : () => this } -declare module "mini-immutable" { - declare class Map { set: : (key: K, value: V) => this } - declare class OrderedMap {} +declare class LinkedList { next(): this } +declare class DoublyLinkedList extends LinkedList { prev(): this } +declare module \"mini-immutable\" { + declare class Map { set(key: K, value: V): this } + declare class OrderedMap extends Map {} } " `; diff --git a/tests/throw/__snapshots__/jsfmt.spec.js.snap b/tests/throw/__snapshots__/jsfmt.spec.js.snap index 2ae1e1974..03093c15f 100644 --- a/tests/throw/__snapshots__/jsfmt.spec.js.snap +++ b/tests/throw/__snapshots__/jsfmt.spec.js.snap @@ -16,7 +16,7 @@ function g(a: ?string) { function h(x: number): string { if (x) { - return \'foo\'; + return 'foo'; } else { throw new Error(); } @@ -38,7 +38,7 @@ function g(a: ?string) { } function h(x: number): string { if (x) { - return \"foo\"; + return "foo"; } else { throw new Error(); } diff --git a/tests/traits/__snapshots__/jsfmt.spec.js.snap b/tests/traits/__snapshots__/jsfmt.spec.js.snap index 0104fc631..893959ab3 100644 --- a/tests/traits/__snapshots__/jsfmt.spec.js.snap +++ b/tests/traits/__snapshots__/jsfmt.spec.js.snap @@ -28,10 +28,10 @@ declare class Baz { // error: Qux wins // error: Bar wins // error: Qux wins -declare class Foo {} -declare class Bar { y: T } -declare class Qux { y: T, z: T } -declare class Baz { x: T } +declare class Foo extends Qux {} +declare class Bar extends Baz { y: T } +declare class Qux extends Baz { y: T; z: T } +declare class Baz { x: T } (new Foo().x: number); (new Foo().y: string); (new Foo().z: number); @@ -42,7 +42,7 @@ exports[`test test2.js 1`] = ` "declare interface I { } declare class C mixins I { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -interface I extends {} +interface I {} declare class C {} " `; diff --git a/tests/try/__snapshots__/jsfmt.spec.js.snap b/tests/try/__snapshots__/jsfmt.spec.js.snap index f883eadba..576815705 100644 --- a/tests/try/__snapshots__/jsfmt.spec.js.snap +++ b/tests/try/__snapshots__/jsfmt.spec.js.snap @@ -91,7 +91,7 @@ function f() { } } -// or try/catch/finally if init doesn\'t dominate +// or try/catch/finally if init doesn't dominate function f() { try { var x:number = 0; @@ -203,7 +203,7 @@ function f(b) { // error // or catch/finally // error -// or try/catch/finally if init doesn\'t dominate +// or try/catch/finally if init doesn't dominate // error // post-use ok because init dominates here // ...but if so, suffix is not reached @@ -364,36 +364,36 @@ exports[`test return.js 1`] = ` function foo(x: ?number): string { try { } catch (e) { - return \'bar\'; + return 'bar'; } console.log(); - return \'foo\'; + return 'foo'; } function bar(): string { try { - return \'foo\'; + return 'foo'; } catch (e) { - return \'bar\'; + return 'bar'; } } function baz(): string { try { - throw new Error(\"foo\"); + throw new Error("foo"); } catch (e) { - return \"foo\"; + return "foo"; } - return \"bar\"; // unreachable + return "bar"; // unreachable } function qux(): string { try { - throw new Error(\"foo\"); + throw new Error("foo"); } catch (e) { } console.log(); - return \'bar\'; + return 'bar'; } function quux(): string { @@ -401,24 +401,24 @@ function quux(): string { return qux(); } catch (e) { } - return \'bar\'; + return 'bar'; } function bliffl(): string { try { - throw new Error(\"foo\"); + throw new Error("foo"); } catch (e) { - return \"foo\"; + return "foo"; } finally { - return \"bar\"; + return "bar"; } } function corge(): string { try { - return \'foo\'; + return 'foo'; } catch (e) { - throw new Error(\'bar\'); + throw new Error('bar'); } bar(); // unreachable } @@ -432,34 +432,34 @@ function foo(x: ?number): string { try { } catch (e) { - return \"bar\"; + return "bar"; } console.log(); - return \"foo\"; + return "foo"; } function bar(): string { try { - return \"foo\"; + return "foo"; } catch (e) { - return \"bar\"; + return "bar"; } } function baz(): string { try { - throw new Error(\"foo\"); + throw new Error("foo"); } catch (e) { - return \"foo\"; + return "foo"; } - return \"bar\"; + return "bar"; } function qux(): string { try { - throw new Error(\"foo\"); + throw new Error("foo"); } catch (e) { } console.log(); - return \"bar\"; + return "bar"; } function quux(): string { try { @@ -467,22 +467,22 @@ function quux(): string { } catch (e) { } - return \"bar\"; + return "bar"; } function bliffl(): string { try { - throw new Error(\"foo\"); + throw new Error("foo"); } catch (e) { - return \"foo\"; + return "foo"; } finally { - return \"bar\"; + return "bar"; } } function corge(): string { try { - return \"foo\"; + return "foo"; } catch (e) { - throw new Error(\"bar\"); + throw new Error("bar"); } bar(); } @@ -499,7 +499,7 @@ function foo() { var x = 0; var y; try { - x = \"\"; + x = ""; } catch(e) { x = false; throw -1; @@ -516,7 +516,7 @@ function bar(response) { try { payload = JSON.parse(response); } catch (e) { - throw new Error(\'...\'); + throw new Error('...'); } // here via [try] only. if (payload.error) { // ok @@ -548,7 +548,7 @@ function foo() { var x = 0; var y; try { - x = \"\"; + x = ""; } catch (e) { x = false; throw -1; @@ -563,7 +563,7 @@ function bar(response) { try { payload = JSON.parse(response); } catch (e) { - throw new Error(\"...\"); + throw new Error("..."); } if (payload.error) { diff --git a/tests/tuples/__snapshots__/jsfmt.spec.js.snap b/tests/tuples/__snapshots__/jsfmt.spec.js.snap index b7fde44ca..d17fca42e 100644 --- a/tests/tuples/__snapshots__/jsfmt.spec.js.snap +++ b/tests/tuples/__snapshots__/jsfmt.spec.js.snap @@ -12,10 +12,10 @@ function foo(x: Array): [number, ?number] { // @flow // Error, can\'t enforce arity when flowing array to tuple // OK. This is unsound, but at least arity is enforced -function foo(x: Array): [number?number] { +function foo(x: Array): [number, ?number] { return x; } -function foo(x: Array): [number?number] { +function foo(x: Array): [number, ?number] { return [ x[0], x[1] ]; } " @@ -33,9 +33,9 @@ exports[`test optional.js 1`] = ` // Ok, correct arity // Error, arity is enforced // error, since second element is not marked optional -([ 0, undefined ]: [number?string]); -([ 0 ]: [number?string]); -([ ]: [?numberstring]); +([ 0, undefined ]: [number, ?string]); +([ 0 ]: [number, ?string]); +([ ]: [?number, string]); " `; @@ -48,7 +48,7 @@ foo([ {} ]); // error, too few elements in array passed to a tuple ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // error, too few elements in array passed to a tuple -function foo(a: [ObjectObject]) { +function foo(a: [Object, Object]) { } foo([ {} ]); @@ -68,8 +68,8 @@ var f: [number, string] = [123, 456]; var a: [] = [ ]; var b: [] = [ 123 ]; var c: [number] = [ ]; -var d: [numberstring] = [ 123, \"duck\" ]; -var e: [numberstring] = [ 123, \"duck\" ]; -var f: [numberstring] = [ 123, 456 ]; +var d: [number, string] = [ 123, \"duck\" ]; +var e: [number, string] = [ 123, \"duck\" ]; +var f: [number, string] = [ 123, 456 ]; " `; diff --git a/tests/type-at-pos/__snapshots__/jsfmt.spec.js.snap b/tests/type-at-pos/__snapshots__/jsfmt.spec.js.snap index bfb5b7ee1..44cfaef76 100644 --- a/tests/type-at-pos/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type-at-pos/__snapshots__/jsfmt.spec.js.snap @@ -28,7 +28,7 @@ export const X = { */ let [ x, y ] = [ 1, 2 ]; export const X = { - returnsATuple: function(): [numbernumber] { + returnsATuple: function(): [number, number] { return [ 1, 2 ]; }, test: function() { @@ -172,14 +172,14 @@ function qux(x?) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -function foo(x: string) { +function foo(x?: string) { return x; } foo(); function bar(obj: { x?: string }) { return obj.x; } -function qux(x) { +function qux(x?) { return x; } " @@ -248,7 +248,7 @@ function foo() { } foo(); str; -type Point = [numberstring]; +type Point = [number, string]; const x: Point = [ 1, \"foo\" ]; type MyStr = \"cool\"; const y: MyStr = \"cool\"; diff --git a/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap b/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap index 2c76d0e18..b87ff74ef 100644 --- a/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type-destructors/__snapshots__/jsfmt.spec.js.snap @@ -34,20 +34,20 @@ exports[`test property_type.js 1`] = ` "type Malformed = $PropertyType; type Obj = { x: string }; -type Obj_Prop_x = $PropertyType; +type Obj_Prop_x = $PropertyType; (42: Obj_Prop_x); -function foo(o: Obj): $PropertyType { +function foo(o: Obj): $PropertyType { if (false) return o.x; else return 0; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Malformed = $PropertyType; type Obj = { x: string }; -type Obj_Prop_x = $PropertyType; +type Obj_Prop_x = $PropertyType; (42: Obj_Prop_x); -function foo(o: Obj): $PropertyType { +function foo(o: Obj): $PropertyType { if (false) return o.x; else @@ -59,8 +59,8 @@ else exports[`test union.js 1`] = ` "var x0: $NonMaybeType = 0; // ok, number ~> number|string var x1: $NonMaybeType = true; // err, boolean ~> number|string -var x2: $PropertyType<{p:number}|{p:string},\'p\'> = 0; // ok, number ~> number|string -var x3: $PropertyType<{p:number}|{p:string},\'p\'> = true; // err, boolean ~> number|string +var x2: $PropertyType<{p:number}|{p:string},'p'> = 0; // ok, number ~> number|string +var x3: $PropertyType<{p:number}|{p:string},'p'> = true; // err, boolean ~> number|string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ok, number ~> number|string // err, boolean ~> number|string @@ -68,7 +68,7 @@ var x3: $PropertyType<{p:number}|{p:string},\'p\'> = true; // err, boolean ~> nu // err, boolean ~> number|string var x0: $NonMaybeType = 0; var x1: $NonMaybeType = true; -var x2: $PropertyType<{ p: number } | { p: string }, \"p\"> = 0; -var x3: $PropertyType<{ p: number } | { p: string }, \"p\"> = true; +var x2: $PropertyType<{ p: number } | { p: string }, "p"> = 0; +var x3: $PropertyType<{ p: number } | { p: string }, "p"> = true; " `; diff --git a/tests/type-printer/__snapshots__/jsfmt.spec.js.snap b/tests/type-printer/__snapshots__/jsfmt.spec.js.snap index d47b09e50..f6f9bb65c 100644 --- a/tests/type-printer/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type-printer/__snapshots__/jsfmt.spec.js.snap @@ -5112,4845 +5112,4845 @@ export type JSXSpreadAttribute = { // TODO: Make this correct. "use strict"; export type Comment = { - type: "CommentLine", - _CommentLine: void, - value: string, - end: number, + type: "CommentLine"; + _CommentLine: void; + value: string; + end: number; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, + end: { column: number; line: number }; + start: { column: number; line: number } + }; start: number } | { - type: "CommentBlock", - _CommentBlock: void, - value: string, - end: number, + type: "CommentBlock"; + _CommentBlock: void; + value: string; + end: number; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, + end: { column: number; line: number }; + start: { column: number; line: number } + }; start: number }; export type Declaration = { - type: "ClassBody", - _ClassBody: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassBody"; + _ClassBody: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ClassDeclaration", - _ClassDeclaration: void, - body: ClassBody, - id: ?Identifier, - superClass: ?Expression, - decorators: any, - superTypeParameters: any, - typeParameters: any, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassDeclaration"; + _ClassDeclaration: void; + body: ClassBody; + id: ?Identifier; + superClass: ?Expression; + decorators: any; + superTypeParameters: any; + typeParameters: any; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "FunctionDeclaration", - _FunctionDeclaration: void, - body: BlockStatement, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionDeclaration"; + _FunctionDeclaration: void; + body: BlockStatement; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "MethodDefinition", - _MethodDefinition: void, - computed: boolean, - key: Node, - kind: "constructor" | "method" | "get" | "set", - static: boolean, - value: FunctionExpression, - decorators: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "MethodDefinition"; + _MethodDefinition: void; + computed: boolean; + key: Node; + kind: "constructor" | "method" | "get" | "set"; + static: boolean; + value: FunctionExpression; + decorators: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "VariableDeclaration", - _VariableDeclaration: void, - declarations: Array, - kind: "var" | "let" | "const", - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "VariableDeclaration"; + _VariableDeclaration: void; + declarations: Array; + kind: "var" | "let" | "const"; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ClassProperty", - _ClassProperty: void, - computed: boolean, - key: Node, - static: boolean, - typeAnnotation: ?TypeAnnotation, - value: ?Expression, - decorators: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassProperty"; + _ClassProperty: void; + computed: boolean; + key: Node; + static: boolean; + typeAnnotation: ?TypeAnnotation; + value: ?Expression; + decorators: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Expression = { - type: "ArrayExpression", - _ArrayExpression: void, - elements: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayExpression"; + _ArrayExpression: void; + elements: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "AssignmentExpression", - _AssignmentExpression: void, - left: Pattern, - operator: AssignmentOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AssignmentExpression"; + _AssignmentExpression: void; + left: Pattern; + operator: AssignmentOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "AwaitExpression", - _AwaitExpression: void, - all: boolean, - argument: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AwaitExpression"; + _AwaitExpression: void; + all: boolean; + argument: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BinaryExpression", - _BinaryExpression: void, - left: Expression, - operator: BinaryOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BinaryExpression"; + _BinaryExpression: void; + left: Expression; + operator: BinaryOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BindExpression", - _BindExpression: void, - callee: Node, - object: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BindExpression"; + _BindExpression: void; + callee: Node; + object: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "CallExpression", - _CallExpression: void, - arguments: Array, - callee: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "CallExpression"; + _CallExpression: void; + arguments: Array; + callee: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ClassExpression", - _ClassExpression: void, - body: ClassBody, - id: ?Identifier, - superClass: ?Expression, - decorators: any, - superTypeParameters: any, - typeParameters: any, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassExpression"; + _ClassExpression: void; + body: ClassBody; + id: ?Identifier; + superClass: ?Expression; + decorators: any; + superTypeParameters: any; + typeParameters: any; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ComprehensionExpression", - _ComprehensionExpression: void, - body: Expression, - blocks: Array, - filter: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ComprehensionExpression"; + _ComprehensionExpression: void; + body: Expression; + blocks: Array; + filter: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ConditionalExpression", - _ConditionalExpression: void, - alternate: Expression, - consequent: Expression, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ConditionalExpression"; + _ConditionalExpression: void; + alternate: Expression; + consequent: Expression; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DoExpression", - _DoExpression: void, - body: Statement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DoExpression"; + _DoExpression: void; + body: Statement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "FunctionExpression", - _FunctionExpression: void, - body: BlockStatement, - id: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionExpression"; + _FunctionExpression: void; + body: BlockStatement; + id: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "Identifier", - _Identifier: void, - name: string, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Identifier"; + _Identifier: void; + name: string; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "Literal", - _Literal: void, - raw: string, - regex: ?{ pattern: string, flags: string }, - value: ?(string | boolean | number | RegExp), - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Literal"; + _Literal: void; + raw: string; + regex: ?{ pattern: string; flags: string }; + value: ?(string | boolean | number | RegExp); + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "LogicalExpression", - _LogicalExpression: void, - left: Expression, - operator: LogicalOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "LogicalExpression"; + _LogicalExpression: void; + left: Expression; + operator: LogicalOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "MemberExpression", - _MemberExpression: void, - computed: boolean, - object: Expression, - property: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "MemberExpression"; + _MemberExpression: void; + computed: boolean; + object: Expression; + property: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "NewExpression", - _NewExpression: void, - arguments: Array, - callee: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NewExpression"; + _NewExpression: void; + arguments: Array; + callee: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ObjectExpression", - _ObjectExpression: void, - properties: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectExpression"; + _ObjectExpression: void; + properties: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "SequenceExpression", - _SequenceExpression: void, - expression: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "SequenceExpression"; + _SequenceExpression: void; + expression: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "TaggedTemplateExpression", - _TaggedTemplateExpression: void, - quasi: TemplateLiteral, - tag: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TaggedTemplateExpression"; + _TaggedTemplateExpression: void; + quasi: TemplateLiteral; + tag: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "TemplateLiteral", - _TemplateLiteral: void, - expressions: Array, - quasis: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TemplateLiteral"; + _TemplateLiteral: void; + expressions: Array; + quasis: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ThisExpression", - _ThisExpression: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ThisExpression"; + _ThisExpression: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "UnaryExpression", - _UnaryExpression: void, - argument: Expression, - operator: UnaryOperator, - prefix: true, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "UnaryExpression"; + _UnaryExpression: void; + argument: Expression; + operator: UnaryOperator; + prefix: true; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "UpdateExpression", - _UpdateExpression: void, - argument: Expression, - operator: UpdateOperator, - prefix: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "UpdateExpression"; + _UpdateExpression: void; + argument: Expression; + operator: UpdateOperator; + prefix: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "YieldExpression", - _YieldExpression: void, - argument: ?Expression, - delegate: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "YieldExpression"; + _YieldExpression: void; + argument: ?Expression; + delegate: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "TypeCastExpression", - _TypeCastExpression: void, - expression: Expression, - typeAnnotation: TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeCastExpression"; + _TypeCastExpression: void; + expression: Expression; + typeAnnotation: TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "JSXElement", - _JSXElement: void, - children: Array, - closingElement: ?JSXClosingElement, - openingElement: JSXOpeningElement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXElement"; + _JSXElement: void; + children: Array; + closingElement: ?JSXClosingElement; + openingElement: JSXOpeningElement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "JSXEmptyExpression", - _JSXEmptyExpression: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXEmptyExpression"; + _JSXEmptyExpression: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "JSXExpressionContainer", - _JSXExpressionContainer: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXExpressionContainer"; + _JSXExpressionContainer: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "JSXMemberExpression", - _JSXMemberExpression: void, - computed: boolean, - object: Node, - property: JSXIdentifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXMemberExpression"; + _JSXMemberExpression: void; + computed: boolean; + object: Node; + property: JSXIdentifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Function = { - type: "ArrowFunctionExpression", - _ArrowFunctionExpression: void, - body: Node, - id: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrowFunctionExpression"; + _ArrowFunctionExpression: void; + body: Node; + id: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "FunctionDeclaration", - _FunctionDeclaration: void, - body: BlockStatement, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionDeclaration"; + _FunctionDeclaration: void; + body: BlockStatement; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "FunctionExpression", - _FunctionExpression: void, - body: BlockStatement, - id: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionExpression"; + _FunctionExpression: void; + body: BlockStatement; + id: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration }; export type Node = { - type: "ArrayExpression", - _ArrayExpression: void, - elements: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayExpression"; + _ArrayExpression: void; + elements: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ArrayPattern", - _ArrayPattern: void, - elements: Array, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayPattern"; + _ArrayPattern: void; + elements: Array; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ArrowFunctionExpression", - _ArrowFunctionExpression: void, - body: Node, - id: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrowFunctionExpression"; + _ArrowFunctionExpression: void; + body: Node; + id: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "AssignmentExpression", - _AssignmentExpression: void, - left: Pattern, - operator: AssignmentOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AssignmentExpression"; + _AssignmentExpression: void; + left: Pattern; + operator: AssignmentOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "AssignmentPattern", - _AssignmentPattern: void, - left: Pattern, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AssignmentPattern"; + _AssignmentPattern: void; + left: Pattern; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "AwaitExpression", - _AwaitExpression: void, - all: boolean, - argument: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AwaitExpression"; + _AwaitExpression: void; + all: boolean; + argument: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BinaryExpression", - _BinaryExpression: void, - left: Expression, - operator: BinaryOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BinaryExpression"; + _BinaryExpression: void; + left: Expression; + operator: BinaryOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BindExpression", - _BindExpression: void, - callee: Node, - object: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BindExpression"; + _BindExpression: void; + callee: Node; + object: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BlockStatement", - _BlockStatement: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BlockStatement"; + _BlockStatement: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BreakStatement", - _BreakStatement: void, - label: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BreakStatement"; + _BreakStatement: void; + label: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "CallExpression", - _CallExpression: void, - arguments: Array, - callee: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "CallExpression"; + _CallExpression: void; + arguments: Array; + callee: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "CatchClause", - _CatchClause: void, - body: BlockStatement, - param: Pattern, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "CatchClause"; + _CatchClause: void; + body: BlockStatement; + param: Pattern; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ClassBody", - _ClassBody: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassBody"; + _ClassBody: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ClassDeclaration", - _ClassDeclaration: void, - body: ClassBody, - id: ?Identifier, - superClass: ?Expression, - decorators: any, - superTypeParameters: any, - typeParameters: any, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassDeclaration"; + _ClassDeclaration: void; + body: ClassBody; + id: ?Identifier; + superClass: ?Expression; + decorators: any; + superTypeParameters: any; + typeParameters: any; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ClassExpression", - _ClassExpression: void, - body: ClassBody, - id: ?Identifier, - superClass: ?Expression, - decorators: any, - superTypeParameters: any, - typeParameters: any, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassExpression"; + _ClassExpression: void; + body: ClassBody; + id: ?Identifier; + superClass: ?Expression; + decorators: any; + superTypeParameters: any; + typeParameters: any; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ComprehensionBlock", - _ComprehensionBlock: void, - each: boolean, - left: Pattern, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ComprehensionBlock"; + _ComprehensionBlock: void; + each: boolean; + left: Pattern; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ComprehensionExpression", - _ComprehensionExpression: void, - body: Expression, - blocks: Array, - filter: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ComprehensionExpression"; + _ComprehensionExpression: void; + body: Expression; + blocks: Array; + filter: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ConditionalExpression", - _ConditionalExpression: void, - alternate: Expression, - consequent: Expression, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ConditionalExpression"; + _ConditionalExpression: void; + alternate: Expression; + consequent: Expression; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ContinueStatement", - _ContinueStatement: void, - label: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ContinueStatement"; + _ContinueStatement: void; + label: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "Decorator", - _Decorator: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Decorator"; + _Decorator: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DebuggerStatement", - _DebuggerStatement: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DebuggerStatement"; + _DebuggerStatement: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DoWhileStatement", - _DoWhileStatement: void, - body: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DoWhileStatement"; + _DoWhileStatement: void; + body: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DoExpression", - _DoExpression: void, - body: Statement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DoExpression"; + _DoExpression: void; + body: Statement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "EmptyStatement", - _EmptyStatement: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "EmptyStatement"; + _EmptyStatement: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ExpressionStatement", - _ExpressionStatement: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExpressionStatement"; + _ExpressionStatement: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "File", - _File: void, - program: Program, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "File"; + _File: void; + program: Program; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ForInStatement", - _ForInStatement: void, - body: Statement, - left: Node, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForInStatement"; + _ForInStatement: void; + body: Statement; + left: Node; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ForOfStatement", - _ForOfStatement: void, - body: Statement, - left: Node, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForOfStatement"; + _ForOfStatement: void; + body: Statement; + left: Node; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ForStatement", - _ForStatement: void, - init: ?Node, - test: ?Expression, - update: ?Expression, - body: Statement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForStatement"; + _ForStatement: void; + init: ?Node; + test: ?Expression; + update: ?Expression; + body: Statement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "FunctionDeclaration", - _FunctionDeclaration: void, - body: BlockStatement, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionDeclaration"; + _FunctionDeclaration: void; + body: BlockStatement; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "FunctionExpression", - _FunctionExpression: void, - body: BlockStatement, - id: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionExpression"; + _FunctionExpression: void; + body: BlockStatement; + id: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration } | { - type: "Identifier", - _Identifier: void, - name: string, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "IfStatement", - _IfStatement: void, - alternate: ?Statement, - consequent: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ImportDefaultSpecifier", - _ImportDefaultSpecifier: void, - local: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ImportNamespaceSpecifier", - _ImportNamespaceSpecifier: void, - local: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ImportDeclaration", - _ImportDeclaration: void, - specifiers: Array, - source: Literal, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ImportSpecifier", - _ImportSpecifier: void, - imported: Node, - local: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "LabeledStatement", - _LabeledStatement: void, - body: Statement, - label: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "Literal", - _Literal: void, - raw: string, - regex: ?{ pattern: string, flags: string }, - value: ?(string | boolean | number | RegExp), - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "LogicalExpression", - _LogicalExpression: void, - left: Expression, - operator: LogicalOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "MemberExpression", - _MemberExpression: void, - computed: boolean, - object: Expression, - property: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "MetaProperty", - _MetaProperty: void, - meta: Node, - property: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "MethodDefinition", - _MethodDefinition: void, - computed: boolean, - key: Node, - kind: "constructor" | "method" | "get" | "set", - static: boolean, - value: FunctionExpression, - decorators: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "NewExpression", - _NewExpression: void, - arguments: Array, - callee: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "Noop", - _Noop: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ObjectExpression", - _ObjectExpression: void, - properties: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ObjectPattern", - _ObjectPattern: void, - properties: Array, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "Program", - _Program: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "Property", - _Property: void, - computed: boolean, - key: Node, - kind: "init" | "get" | "set", - method: boolean, - shorthand: boolean, - value: Node, - decorators: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "RestElement", - _RestElement: void, - argument: Pattern, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ReturnStatement", - _ReturnStatement: void, - argument: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "SequenceExpression", - _SequenceExpression: void, - expression: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "SpreadElement", - _SpreadElement: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "SpreadProperty", - _SpreadProperty: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "Super", - _Super: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "SwitchCase", - _SwitchCase: void, - consequent: Array, - test: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "SwitchStatement", - _SwitchStatement: void, - cases: Array, - discriminant: Expression, - lexical: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TaggedTemplateExpression", - _TaggedTemplateExpression: void, - quasi: TemplateLiteral, - tag: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TemplateElement", - _TemplateElement: void, - tail: boolean, - value: { cooked: string, raw: string }, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TemplateLiteral", - _TemplateLiteral: void, - expressions: Array, - quasis: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ThisExpression", - _ThisExpression: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ThrowStatement", - _ThrowStatement: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TryStatement", - _TryStatement: void, - block: BlockStatement, - finalizer: ?BlockStatement, - guardedHandlers: Array, - handler: ?CatchClause, - handlers: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "UnaryExpression", - _UnaryExpression: void, - argument: Expression, - operator: UnaryOperator, - prefix: true, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "UpdateExpression", - _UpdateExpression: void, - argument: Expression, - operator: UpdateOperator, - prefix: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "VariableDeclaration", - _VariableDeclaration: void, - declarations: Array, - kind: "var" | "let" | "const", - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "VariableDeclarator", - _VariableDeclarator: void, - id: Pattern, - init: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "WhileStatement", - _WhileStatement: void, - body: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "WithStatement", - _WithStatement: void, - body: Statement, - object: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "YieldExpression", - _YieldExpression: void, - argument: ?Expression, - delegate: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ExportAllDeclaration", - _ExportAllDeclaration: void, - exported: Node, - source: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ExportDefaultDeclaration", - _ExportDefaultDeclaration: void, - declaration: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ExportNamedDeclaration", - _ExportNamedDeclaration: void, - declaration: Node, - source: Literal, - specifiers: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ExportDefaultSpecifier", - _ExportDefaultSpecifier: void, - exported: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ExportNamespaceSpecifier", - _ExportNamespaceSpecifier: void, - exported: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ExportSpecifier", - _ExportSpecifier: void, - local: Node, - exported: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "AnyTypeAnnotation", - _AnyTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ArrayTypeAnnotation", - _ArrayTypeAnnotation: void, - elementType: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "BooleanLiteralTypeAnnotation", - _BooleanLiteralTypeAnnotation: void, - raw: string, - value: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "BooleanTypeAnnotation", - _BooleanTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ClassImplements", - _ClassImplements: void, - id: Identifier, - typeParameters: ?TypeParameterInstantiation, - superClass: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ClassProperty", - _ClassProperty: void, - computed: boolean, - key: Node, - static: boolean, - typeAnnotation: ?TypeAnnotation, - value: ?Expression, - decorators: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "DeclareClass", - _DeclareClass: void, - body: ObjectTypeAnnotation, - extends: Array, - id: Identifier, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "DeclareFunction", - _DeclareFunction: void, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "DeclareModule", - _DeclareModule: void, - body: BlockStatement, - id: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "DeclareVariable", - _DeclareVariable: void, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "FunctionTypeAnnotation", - _FunctionTypeAnnotation: void, - params: Array, - rest: ?FunctionTypeParam, - returnType: Type, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "FunctionTypeParam", - _FunctionTypeParam: void, - name: Identifier, - optional: boolean, - typeAnnotation: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "GenericTypeAnnotation", - _GenericTypeAnnotation: void, - id: Node, - typeParameters: ?TypeParameterInstantiation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "InterfaceExtends", - _InterfaceExtends: void, - id: Identifier, - typeParameters: ?TypeParameterInstantiation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "InterfaceDeclaration", - _InterfaceDeclaration: void, - body: ObjectTypeAnnotation, - extends: Array, - id: Identifier, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "IntersectionTypeAnnotation", - _IntersectionTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "MixedTypeAnnotation", - _MixedTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "NullableTypeAnnotation", - _NullableTypeAnnotation: void, - typeAnnotation: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "NumberLiteralTypeAnnotation", - _NumberLiteralTypeAnnotation: void, - raw: string, - value: number, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "NumberTypeAnnotation", - _NumberTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "StringLiteralTypeAnnotation", - _StringLiteralTypeAnnotation: void, - raw: string, - value: string, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "StringTypeAnnotation", - _StringTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TupleTypeAnnotation", - _TupleTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TypeofTypeAnnotation", - _TypeofTypeAnnotation: void, - argument: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TypeAlias", - _TypeAlias: void, - id: Identifier, - right: Type, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TypeAnnotation", - _TypeAnnotation: void, - typeAnnotation: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TypeCastExpression", - _TypeCastExpression: void, - expression: Expression, - typeAnnotation: TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TypeParameterDeclaration", - _TypeParameterDeclaration: void, - params: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "TypeParameterInstantiation", - _TypeParameterInstantiation: void, - params: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ObjectTypeAnnotation", - _ObjectTypeAnnotation: void, - callProperties: Array, - indexers: Array, - properties: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ObjectTypeCallProperty", - _ObjectTypeCallProperty: void, - static: boolean, - value: FunctionTypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ObjectTypeIndexer", - _ObjectTypeIndexer: void, - id: Identifier, - key: Type, - value: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "ObjectTypeProperty", - _ObjectTypeProperty: void, - key: Node, - optional: boolean, - value: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "QualifiedTypeIdentifier", - _QualifiedTypeIdentifier: void, - id: Identifier, - qualification: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "UnionTypeAnnotation", - _UnionTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "VoidTypeAnnotation", - _VoidTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXAttribute", - _JSXAttribute: void, - name: Node, - value: ?Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXClosingElement", - _JSXClosingElement: void, - name: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXElement", - _JSXElement: void, - children: Array, - closingElement: ?JSXClosingElement, - openingElement: JSXOpeningElement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXEmptyExpression", - _JSXEmptyExpression: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXExpressionContainer", - _JSXExpressionContainer: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXIdentifier", - _JSXIdentifier: void, - name: string, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXMemberExpression", - _JSXMemberExpression: void, - computed: boolean, - object: Node, - property: JSXIdentifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXNamespacedName", - _JSXNamespacedName: void, - name: JSXIdentifier, - namespace: JSXIdentifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXOpeningElement", - _JSXOpeningElement: void, - attributes: Array, - name: Array, - selfClosing: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array -} | { - type: "JSXSpreadAttribute", - _JSXSpreadAttribute: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, - loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + type: "Identifier"; + _Identifier: void; + name: string; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "IfStatement"; + _IfStatement: void; + alternate: ?Statement; + consequent: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ImportDefaultSpecifier"; + _ImportDefaultSpecifier: void; + local: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ImportNamespaceSpecifier"; + _ImportNamespaceSpecifier: void; + local: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ImportDeclaration"; + _ImportDeclaration: void; + specifiers: Array; + source: Literal; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ImportSpecifier"; + _ImportSpecifier: void; + imported: Node; + local: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "LabeledStatement"; + _LabeledStatement: void; + body: Statement; + label: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "Literal"; + _Literal: void; + raw: string; + regex: ?{ pattern: string; flags: string }; + value: ?(string | boolean | number | RegExp); + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "LogicalExpression"; + _LogicalExpression: void; + left: Expression; + operator: LogicalOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "MemberExpression"; + _MemberExpression: void; + computed: boolean; + object: Expression; + property: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "MetaProperty"; + _MetaProperty: void; + meta: Node; + property: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "MethodDefinition"; + _MethodDefinition: void; + computed: boolean; + key: Node; + kind: "constructor" | "method" | "get" | "set"; + static: boolean; + value: FunctionExpression; + decorators: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "NewExpression"; + _NewExpression: void; + arguments: Array; + callee: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "Noop"; + _Noop: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ObjectExpression"; + _ObjectExpression: void; + properties: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ObjectPattern"; + _ObjectPattern: void; + properties: Array; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "Program"; + _Program: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "Property"; + _Property: void; + computed: boolean; + key: Node; + kind: "init" | "get" | "set"; + method: boolean; + shorthand: boolean; + value: Node; + decorators: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "RestElement"; + _RestElement: void; + argument: Pattern; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ReturnStatement"; + _ReturnStatement: void; + argument: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "SequenceExpression"; + _SequenceExpression: void; + expression: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "SpreadElement"; + _SpreadElement: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "SpreadProperty"; + _SpreadProperty: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "Super"; + _Super: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "SwitchCase"; + _SwitchCase: void; + consequent: Array; + test: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "SwitchStatement"; + _SwitchStatement: void; + cases: Array; + discriminant: Expression; + lexical: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TaggedTemplateExpression"; + _TaggedTemplateExpression: void; + quasi: TemplateLiteral; + tag: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TemplateElement"; + _TemplateElement: void; + tail: boolean; + value: { cooked: string; raw: string }; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TemplateLiteral"; + _TemplateLiteral: void; + expressions: Array; + quasis: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ThisExpression"; + _ThisExpression: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ThrowStatement"; + _ThrowStatement: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TryStatement"; + _TryStatement: void; + block: BlockStatement; + finalizer: ?BlockStatement; + guardedHandlers: Array; + handler: ?CatchClause; + handlers: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "UnaryExpression"; + _UnaryExpression: void; + argument: Expression; + operator: UnaryOperator; + prefix: true; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "UpdateExpression"; + _UpdateExpression: void; + argument: Expression; + operator: UpdateOperator; + prefix: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "VariableDeclaration"; + _VariableDeclaration: void; + declarations: Array; + kind: "var" | "let" | "const"; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "VariableDeclarator"; + _VariableDeclarator: void; + id: Pattern; + init: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "WhileStatement"; + _WhileStatement: void; + body: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "WithStatement"; + _WithStatement: void; + body: Statement; + object: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "YieldExpression"; + _YieldExpression: void; + argument: ?Expression; + delegate: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ExportAllDeclaration"; + _ExportAllDeclaration: void; + exported: Node; + source: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ExportDefaultDeclaration"; + _ExportDefaultDeclaration: void; + declaration: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ExportNamedDeclaration"; + _ExportNamedDeclaration: void; + declaration: Node; + source: Literal; + specifiers: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ExportDefaultSpecifier"; + _ExportDefaultSpecifier: void; + exported: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ExportNamespaceSpecifier"; + _ExportNamespaceSpecifier: void; + exported: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ExportSpecifier"; + _ExportSpecifier: void; + local: Node; + exported: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "AnyTypeAnnotation"; + _AnyTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ArrayTypeAnnotation"; + _ArrayTypeAnnotation: void; + elementType: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "BooleanLiteralTypeAnnotation"; + _BooleanLiteralTypeAnnotation: void; + raw: string; + value: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "BooleanTypeAnnotation"; + _BooleanTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ClassImplements"; + _ClassImplements: void; + id: Identifier; + typeParameters: ?TypeParameterInstantiation; + superClass: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ClassProperty"; + _ClassProperty: void; + computed: boolean; + key: Node; + static: boolean; + typeAnnotation: ?TypeAnnotation; + value: ?Expression; + decorators: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "DeclareClass"; + _DeclareClass: void; + body: ObjectTypeAnnotation; + extends: Array; + id: Identifier; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "DeclareFunction"; + _DeclareFunction: void; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "DeclareModule"; + _DeclareModule: void; + body: BlockStatement; + id: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "DeclareVariable"; + _DeclareVariable: void; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "FunctionTypeAnnotation"; + _FunctionTypeAnnotation: void; + params: Array; + rest: ?FunctionTypeParam; + returnType: Type; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "FunctionTypeParam"; + _FunctionTypeParam: void; + name: Identifier; + optional: boolean; + typeAnnotation: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "GenericTypeAnnotation"; + _GenericTypeAnnotation: void; + id: Node; + typeParameters: ?TypeParameterInstantiation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "InterfaceExtends"; + _InterfaceExtends: void; + id: Identifier; + typeParameters: ?TypeParameterInstantiation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "InterfaceDeclaration"; + _InterfaceDeclaration: void; + body: ObjectTypeAnnotation; + extends: Array; + id: Identifier; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "IntersectionTypeAnnotation"; + _IntersectionTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "MixedTypeAnnotation"; + _MixedTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "NullableTypeAnnotation"; + _NullableTypeAnnotation: void; + typeAnnotation: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "NumberLiteralTypeAnnotation"; + _NumberLiteralTypeAnnotation: void; + raw: string; + value: number; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "NumberTypeAnnotation"; + _NumberTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "StringLiteralTypeAnnotation"; + _StringLiteralTypeAnnotation: void; + raw: string; + value: string; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "StringTypeAnnotation"; + _StringTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TupleTypeAnnotation"; + _TupleTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TypeofTypeAnnotation"; + _TypeofTypeAnnotation: void; + argument: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TypeAlias"; + _TypeAlias: void; + id: Identifier; + right: Type; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TypeAnnotation"; + _TypeAnnotation: void; + typeAnnotation: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TypeCastExpression"; + _TypeCastExpression: void; + expression: Expression; + typeAnnotation: TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TypeParameterDeclaration"; + _TypeParameterDeclaration: void; + params: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "TypeParameterInstantiation"; + _TypeParameterInstantiation: void; + params: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ObjectTypeAnnotation"; + _ObjectTypeAnnotation: void; + callProperties: Array; + indexers: Array; + properties: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ObjectTypeCallProperty"; + _ObjectTypeCallProperty: void; + static: boolean; + value: FunctionTypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ObjectTypeIndexer"; + _ObjectTypeIndexer: void; + id: Identifier; + key: Type; + value: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "ObjectTypeProperty"; + _ObjectTypeProperty: void; + key: Node; + optional: boolean; + value: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "QualifiedTypeIdentifier"; + _QualifiedTypeIdentifier: void; + id: Identifier; + qualification: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "UnionTypeAnnotation"; + _UnionTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "VoidTypeAnnotation"; + _VoidTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXAttribute"; + _JSXAttribute: void; + name: Node; + value: ?Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXClosingElement"; + _JSXClosingElement: void; + name: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXElement"; + _JSXElement: void; + children: Array; + closingElement: ?JSXClosingElement; + openingElement: JSXOpeningElement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXEmptyExpression"; + _JSXEmptyExpression: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXExpressionContainer"; + _JSXExpressionContainer: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXIdentifier"; + _JSXIdentifier: void; + name: string; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXMemberExpression"; + _JSXMemberExpression: void; + computed: boolean; + object: Node; + property: JSXIdentifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXNamespacedName"; + _JSXNamespacedName: void; + name: JSXIdentifier; + namespace: JSXIdentifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXOpeningElement"; + _JSXOpeningElement: void; + attributes: Array; + name: Array; + selfClosing: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array +} | { + type: "JSXSpreadAttribute"; + _JSXSpreadAttribute: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; + loc: { + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Pattern = { - type: "ArrayPattern", - _ArrayPattern: void, - elements: Array, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayPattern"; + _ArrayPattern: void; + elements: Array; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "AssignmentPattern", - _AssignmentPattern: void, - left: Pattern, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AssignmentPattern"; + _AssignmentPattern: void; + left: Pattern; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "Identifier", - _Identifier: void, - name: string, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Identifier"; + _Identifier: void; + name: string; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ObjectPattern", - _ObjectPattern: void, - properties: Array, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectPattern"; + _ObjectPattern: void; + properties: Array; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "RestElement", - _RestElement: void, - argument: Pattern, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "RestElement"; + _RestElement: void; + argument: Pattern; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Statement = { - type: "BlockStatement", - _BlockStatement: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BlockStatement"; + _BlockStatement: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BreakStatement", - _BreakStatement: void, - label: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BreakStatement"; + _BreakStatement: void; + label: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ContinueStatement", - _ContinueStatement: void, - label: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ContinueStatement"; + _ContinueStatement: void; + label: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DoWhileStatement", - _DoWhileStatement: void, - body: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DoWhileStatement"; + _DoWhileStatement: void; + body: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "EmptyStatement", - _EmptyStatement: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "EmptyStatement"; + _EmptyStatement: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ExpressionStatement", - _ExpressionStatement: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExpressionStatement"; + _ExpressionStatement: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ForInStatement", - _ForInStatement: void, - body: Statement, - left: Node, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForInStatement"; + _ForInStatement: void; + body: Statement; + left: Node; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ForOfStatement", - _ForOfStatement: void, - body: Statement, - left: Node, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForOfStatement"; + _ForOfStatement: void; + body: Statement; + left: Node; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ForStatement", - _ForStatement: void, - init: ?Node, - test: ?Expression, - update: ?Expression, - body: Statement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForStatement"; + _ForStatement: void; + init: ?Node; + test: ?Expression; + update: ?Expression; + body: Statement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "IfStatement", - _IfStatement: void, - alternate: ?Statement, - consequent: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "IfStatement"; + _IfStatement: void; + alternate: ?Statement; + consequent: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "LabeledStatement", - _LabeledStatement: void, - body: Statement, - label: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "LabeledStatement"; + _LabeledStatement: void; + body: Statement; + label: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ReturnStatement", - _ReturnStatement: void, - argument: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ReturnStatement"; + _ReturnStatement: void; + argument: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "SwitchStatement", - _SwitchStatement: void, - cases: Array, - discriminant: Expression, - lexical: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "SwitchStatement"; + _SwitchStatement: void; + cases: Array; + discriminant: Expression; + lexical: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ThrowStatement", - _ThrowStatement: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ThrowStatement"; + _ThrowStatement: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "TryStatement", - _TryStatement: void, - block: BlockStatement, - finalizer: ?BlockStatement, - guardedHandlers: Array, - handler: ?CatchClause, - handlers: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TryStatement"; + _TryStatement: void; + block: BlockStatement; + finalizer: ?BlockStatement; + guardedHandlers: Array; + handler: ?CatchClause; + handlers: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "WhileStatement", - _WhileStatement: void, - body: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "WhileStatement"; + _WhileStatement: void; + body: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "WithStatement", - _WithStatement: void, - body: Statement, - object: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "WithStatement"; + _WithStatement: void; + body: Statement; + object: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DeclareClass", - _DeclareClass: void, - body: ObjectTypeAnnotation, - extends: Array, - id: Identifier, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareClass"; + _DeclareClass: void; + body: ObjectTypeAnnotation; + extends: Array; + id: Identifier; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DeclareFunction", - _DeclareFunction: void, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareFunction"; + _DeclareFunction: void; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DeclareModule", - _DeclareModule: void, - body: BlockStatement, - id: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareModule"; + _DeclareModule: void; + body: BlockStatement; + id: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "DeclareVariable", - _DeclareVariable: void, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareVariable"; + _DeclareVariable: void; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "InterfaceDeclaration", - _InterfaceDeclaration: void, - body: ObjectTypeAnnotation, - extends: Array, - id: Identifier, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "InterfaceDeclaration"; + _InterfaceDeclaration: void; + body: ObjectTypeAnnotation; + extends: Array; + id: Identifier; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "TypeAlias", - _TypeAlias: void, - id: Identifier, - right: Type, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeAlias"; + _TypeAlias: void; + id: Identifier; + right: Type; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Type = { - type: "AnyTypeAnnotation", - _AnyTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AnyTypeAnnotation"; + _AnyTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ArrayTypeAnnotation", - _ArrayTypeAnnotation: void, - elementType: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayTypeAnnotation"; + _ArrayTypeAnnotation: void; + elementType: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BooleanLiteralTypeAnnotation", - _BooleanLiteralTypeAnnotation: void, - raw: string, - value: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BooleanLiteralTypeAnnotation"; + _BooleanLiteralTypeAnnotation: void; + raw: string; + value: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "BooleanTypeAnnotation", - _BooleanTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BooleanTypeAnnotation"; + _BooleanTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "FunctionTypeAnnotation", - _FunctionTypeAnnotation: void, - params: Array, - rest: ?FunctionTypeParam, - returnType: Type, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionTypeAnnotation"; + _FunctionTypeAnnotation: void; + params: Array; + rest: ?FunctionTypeParam; + returnType: Type; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "GenericTypeAnnotation", - _GenericTypeAnnotation: void, - id: Node, - typeParameters: ?TypeParameterInstantiation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "GenericTypeAnnotation"; + _GenericTypeAnnotation: void; + id: Node; + typeParameters: ?TypeParameterInstantiation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "IntersectionTypeAnnotation", - _IntersectionTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "IntersectionTypeAnnotation"; + _IntersectionTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "MixedTypeAnnotation", - _MixedTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "MixedTypeAnnotation"; + _MixedTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "NullableTypeAnnotation", - _NullableTypeAnnotation: void, - typeAnnotation: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NullableTypeAnnotation"; + _NullableTypeAnnotation: void; + typeAnnotation: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "NumberLiteralTypeAnnotation", - _NumberLiteralTypeAnnotation: void, - raw: string, - value: number, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NumberLiteralTypeAnnotation"; + _NumberLiteralTypeAnnotation: void; + raw: string; + value: number; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "NumberTypeAnnotation", - _NumberTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NumberTypeAnnotation"; + _NumberTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "StringLiteralTypeAnnotation", - _StringLiteralTypeAnnotation: void, - raw: string, - value: string, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "StringLiteralTypeAnnotation"; + _StringLiteralTypeAnnotation: void; + raw: string; + value: string; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "StringTypeAnnotation", - _StringTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "StringTypeAnnotation"; + _StringTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "TupleTypeAnnotation", - _TupleTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TupleTypeAnnotation"; + _TupleTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "ObjectTypeAnnotation", - _ObjectTypeAnnotation: void, - callProperties: Array, - indexers: Array, - properties: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectTypeAnnotation"; + _ObjectTypeAnnotation: void; + callProperties: Array; + indexers: Array; + properties: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "UnionTypeAnnotation", - _UnionTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "UnionTypeAnnotation"; + _UnionTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array } | { - type: "VoidTypeAnnotation", - _VoidTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "VoidTypeAnnotation"; + _VoidTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type CommentLine = { - type: "CommentLine", - _CommentLine: void, - value: string, - end: number, + type: "CommentLine"; + _CommentLine: void; + value: string; + end: number; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, + end: { column: number; line: number }; + start: { column: number; line: number } + }; start: number }; export type CommentBlock = { - type: "CommentBlock", - _CommentBlock: void, - value: string, - end: number, + type: "CommentBlock"; + _CommentBlock: void; + value: string; + end: number; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, + end: { column: number; line: number }; + start: { column: number; line: number } + }; start: number }; export type ArrayExpression = { - type: "ArrayExpression", - _ArrayExpression: void, - elements: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayExpression"; + _ArrayExpression: void; + elements: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ArrayPattern = { - type: "ArrayPattern", - _ArrayPattern: void, - elements: Array, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayPattern"; + _ArrayPattern: void; + elements: Array; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ArrowFunctionExpression = { - type: "ArrowFunctionExpression", - _ArrowFunctionExpression: void, - body: Node, - id: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrowFunctionExpression"; + _ArrowFunctionExpression: void; + body: Node; + id: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration }; type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&="; export type AssignmentExpression = { - type: "AssignmentExpression", - _AssignmentExpression: void, - left: Pattern, - operator: AssignmentOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AssignmentExpression"; + _AssignmentExpression: void; + left: Pattern; + operator: AssignmentOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type AssignmentPattern = { - type: "AssignmentPattern", - _AssignmentPattern: void, - left: Pattern, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AssignmentPattern"; + _AssignmentPattern: void; + left: Pattern; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type AwaitExpression = { - type: "AwaitExpression", - _AwaitExpression: void, - all: boolean, - argument: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AwaitExpression"; + _AwaitExpression: void; + all: boolean; + argument: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "&" | "|" | "^" | "in" | "instanceof" | ".."; export type BinaryExpression = { - type: "BinaryExpression", - _BinaryExpression: void, - left: Expression, - operator: BinaryOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BinaryExpression"; + _BinaryExpression: void; + left: Expression; + operator: BinaryOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type BindExpression = { - type: "BindExpression", - _BindExpression: void, - callee: Node, - object: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BindExpression"; + _BindExpression: void; + callee: Node; + object: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type BlockStatement = { - type: "BlockStatement", - _BlockStatement: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BlockStatement"; + _BlockStatement: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type BreakStatement = { - type: "BreakStatement", - _BreakStatement: void, - label: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BreakStatement"; + _BreakStatement: void; + label: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type CallExpression = { - type: "CallExpression", - _CallExpression: void, - arguments: Array, - callee: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "CallExpression"; + _CallExpression: void; + arguments: Array; + callee: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type CatchClause = { - type: "CatchClause", - _CatchClause: void, - body: BlockStatement, - param: Pattern, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "CatchClause"; + _CatchClause: void; + body: BlockStatement; + param: Pattern; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ClassBody = { - type: "ClassBody", - _ClassBody: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassBody"; + _ClassBody: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ClassDeclaration = { - type: "ClassDeclaration", - _ClassDeclaration: void, - body: ClassBody, - id: ?Identifier, - superClass: ?Expression, - decorators: any, - superTypeParameters: any, - typeParameters: any, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassDeclaration"; + _ClassDeclaration: void; + body: ClassBody; + id: ?Identifier; + superClass: ?Expression; + decorators: any; + superTypeParameters: any; + typeParameters: any; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ClassExpression = { - type: "ClassExpression", - _ClassExpression: void, - body: ClassBody, - id: ?Identifier, - superClass: ?Expression, - decorators: any, - superTypeParameters: any, - typeParameters: any, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassExpression"; + _ClassExpression: void; + body: ClassBody; + id: ?Identifier; + superClass: ?Expression; + decorators: any; + superTypeParameters: any; + typeParameters: any; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ComprehensionBlock = { - type: "ComprehensionBlock", - _ComprehensionBlock: void, - each: boolean, - left: Pattern, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ComprehensionBlock"; + _ComprehensionBlock: void; + each: boolean; + left: Pattern; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ComprehensionExpression = { - type: "ComprehensionExpression", - _ComprehensionExpression: void, - body: Expression, - blocks: Array, - filter: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ComprehensionExpression"; + _ComprehensionExpression: void; + body: Expression; + blocks: Array; + filter: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ConditionalExpression = { - type: "ConditionalExpression", - _ConditionalExpression: void, - alternate: Expression, - consequent: Expression, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ConditionalExpression"; + _ConditionalExpression: void; + alternate: Expression; + consequent: Expression; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ContinueStatement = { - type: "ContinueStatement", - _ContinueStatement: void, - label: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ContinueStatement"; + _ContinueStatement: void; + label: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Decorator = { - type: "Decorator", - _Decorator: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Decorator"; + _Decorator: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type DebuggerStatement = { - type: "DebuggerStatement", - _DebuggerStatement: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DebuggerStatement"; + _DebuggerStatement: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type DoWhileStatement = { - type: "DoWhileStatement", - _DoWhileStatement: void, - body: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DoWhileStatement"; + _DoWhileStatement: void; + body: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type DoExpression = { - type: "DoExpression", - _DoExpression: void, - body: Statement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DoExpression"; + _DoExpression: void; + body: Statement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type EmptyStatement = { - type: "EmptyStatement", - _EmptyStatement: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "EmptyStatement"; + _EmptyStatement: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ExpressionStatement = { - type: "ExpressionStatement", - _ExpressionStatement: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExpressionStatement"; + _ExpressionStatement: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type File = { - type: "File", - _File: void, - program: Program, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "File"; + _File: void; + program: Program; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ForInStatement = { - type: "ForInStatement", - _ForInStatement: void, - body: Statement, - left: Node, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForInStatement"; + _ForInStatement: void; + body: Statement; + left: Node; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ForOfStatement = { - type: "ForOfStatement", - _ForOfStatement: void, - body: Statement, - left: Node, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForOfStatement"; + _ForOfStatement: void; + body: Statement; + left: Node; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ForStatement = { - type: "ForStatement", - _ForStatement: void, - init: ?Node, - test: ?Expression, - update: ?Expression, - body: Statement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ForStatement"; + _ForStatement: void; + init: ?Node; + test: ?Expression; + update: ?Expression; + body: Statement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type FunctionDeclaration = { - type: "FunctionDeclaration", - _FunctionDeclaration: void, - body: BlockStatement, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionDeclaration"; + _FunctionDeclaration: void; + body: BlockStatement; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration }; export type FunctionExpression = { - type: "FunctionExpression", - _FunctionExpression: void, - body: BlockStatement, - id: ?Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionExpression"; + _FunctionExpression: void; + body: BlockStatement; + id: ?Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, - trailingComments: ?Array, - async: boolean, - defaults: Array, - expression: boolean, - generator: boolean, - params: Array, - rest: ?Identifier, - returnType: ?TypeAnnotation, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; + trailingComments: ?Array; + async: boolean; + defaults: Array; + expression: boolean; + generator: boolean; + params: Array; + rest: ?Identifier; + returnType: ?TypeAnnotation; typeParameters: ?TypeParameterDeclaration }; export type Identifier = { - type: "Identifier", - _Identifier: void, - name: string, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Identifier"; + _Identifier: void; + name: string; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type IfStatement = { - type: "IfStatement", - _IfStatement: void, - alternate: ?Statement, - consequent: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "IfStatement"; + _IfStatement: void; + alternate: ?Statement; + consequent: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ImportDefaultSpecifier = { - type: "ImportDefaultSpecifier", - _ImportDefaultSpecifier: void, - local: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ImportDefaultSpecifier"; + _ImportDefaultSpecifier: void; + local: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ImportNamespaceSpecifier = { - type: "ImportNamespaceSpecifier", - _ImportNamespaceSpecifier: void, - local: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ImportNamespaceSpecifier"; + _ImportNamespaceSpecifier: void; + local: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ImportDeclaration = { - type: "ImportDeclaration", - _ImportDeclaration: void, - specifiers: Array, - source: Literal, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ImportDeclaration"; + _ImportDeclaration: void; + specifiers: Array; + source: Literal; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ImportSpecifier = { - type: "ImportSpecifier", - _ImportSpecifier: void, - imported: Node, - local: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ImportSpecifier"; + _ImportSpecifier: void; + imported: Node; + local: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type LabeledStatement = { - type: "LabeledStatement", - _LabeledStatement: void, - body: Statement, - label: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "LabeledStatement"; + _LabeledStatement: void; + body: Statement; + label: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Literal = { - type: "Literal", - _Literal: void, - raw: string, - regex: ?{ pattern: string, flags: string }, - value: ?(string | boolean | number | RegExp), - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Literal"; + _Literal: void; + raw: string; + regex: ?{ pattern: string; flags: string }; + value: ?(string | boolean | number | RegExp); + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; type LogicalOperator = "||" | "&&"; export type LogicalExpression = { - type: "LogicalExpression", - _LogicalExpression: void, - left: Expression, - operator: LogicalOperator, - right: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "LogicalExpression"; + _LogicalExpression: void; + left: Expression; + operator: LogicalOperator; + right: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type MemberExpression = { - type: "MemberExpression", - _MemberExpression: void, - computed: boolean, - object: Expression, - property: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "MemberExpression"; + _MemberExpression: void; + computed: boolean; + object: Expression; + property: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type MetaProperty = { - type: "MetaProperty", - _MetaProperty: void, - meta: Node, - property: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "MetaProperty"; + _MetaProperty: void; + meta: Node; + property: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type MethodDefinition = { - type: "MethodDefinition", - _MethodDefinition: void, - computed: boolean, - key: Node, - kind: "constructor" | "method" | "get" | "set", - static: boolean, - value: FunctionExpression, - decorators: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "MethodDefinition"; + _MethodDefinition: void; + computed: boolean; + key: Node; + kind: "constructor" | "method" | "get" | "set"; + static: boolean; + value: FunctionExpression; + decorators: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type NewExpression = { - type: "NewExpression", - _NewExpression: void, - arguments: Array, - callee: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NewExpression"; + _NewExpression: void; + arguments: Array; + callee: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Noop = { - type: "Noop", - _Noop: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Noop"; + _Noop: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ObjectExpression = { - type: "ObjectExpression", - _ObjectExpression: void, - properties: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectExpression"; + _ObjectExpression: void; + properties: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ObjectPattern = { - type: "ObjectPattern", - _ObjectPattern: void, - properties: Array, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectPattern"; + _ObjectPattern: void; + properties: Array; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Program = { - type: "Program", - _Program: void, - body: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Program"; + _Program: void; + body: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Property = { - type: "Property", - _Property: void, - computed: boolean, - key: Node, - kind: "init" | "get" | "set", - method: boolean, - shorthand: boolean, - value: Node, - decorators: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Property"; + _Property: void; + computed: boolean; + key: Node; + kind: "init" | "get" | "set"; + method: boolean; + shorthand: boolean; + value: Node; + decorators: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type RestElement = { - type: "RestElement", - _RestElement: void, - argument: Pattern, - typeAnnotation: ?TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "RestElement"; + _RestElement: void; + argument: Pattern; + typeAnnotation: ?TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ReturnStatement = { - type: "ReturnStatement", - _ReturnStatement: void, - argument: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ReturnStatement"; + _ReturnStatement: void; + argument: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type SequenceExpression = { - type: "SequenceExpression", - _SequenceExpression: void, - expression: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "SequenceExpression"; + _SequenceExpression: void; + expression: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type SpreadElement = { - type: "SpreadElement", - _SpreadElement: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "SpreadElement"; + _SpreadElement: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type SpreadProperty = { - type: "SpreadProperty", - _SpreadProperty: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "SpreadProperty"; + _SpreadProperty: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type Super = { - type: "Super", - _Super: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "Super"; + _Super: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type SwitchCase = { - type: "SwitchCase", - _SwitchCase: void, - consequent: Array, - test: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "SwitchCase"; + _SwitchCase: void; + consequent: Array; + test: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type SwitchStatement = { - type: "SwitchStatement", - _SwitchStatement: void, - cases: Array, - discriminant: Expression, - lexical: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "SwitchStatement"; + _SwitchStatement: void; + cases: Array; + discriminant: Expression; + lexical: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TaggedTemplateExpression = { - type: "TaggedTemplateExpression", - _TaggedTemplateExpression: void, - quasi: TemplateLiteral, - tag: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TaggedTemplateExpression"; + _TaggedTemplateExpression: void; + quasi: TemplateLiteral; + tag: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TemplateElement = { - type: "TemplateElement", - _TemplateElement: void, - tail: boolean, - value: { cooked: string, raw: string }, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TemplateElement"; + _TemplateElement: void; + tail: boolean; + value: { cooked: string; raw: string }; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TemplateLiteral = { - type: "TemplateLiteral", - _TemplateLiteral: void, - expressions: Array, - quasis: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TemplateLiteral"; + _TemplateLiteral: void; + expressions: Array; + quasis: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ThisExpression = { - type: "ThisExpression", - _ThisExpression: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ThisExpression"; + _ThisExpression: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ThrowStatement = { - type: "ThrowStatement", - _ThrowStatement: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ThrowStatement"; + _ThrowStatement: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TryStatement = { - type: "TryStatement", - _TryStatement: void, - block: BlockStatement, - finalizer: ?BlockStatement, - guardedHandlers: Array, - handler: ?CatchClause, - handlers: ?Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TryStatement"; + _TryStatement: void; + block: BlockStatement; + finalizer: ?BlockStatement; + guardedHandlers: Array; + handler: ?CatchClause; + handlers: ?Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; export type UnaryExpression = { - type: "UnaryExpression", - _UnaryExpression: void, - argument: Expression, - operator: UnaryOperator, - prefix: true, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "UnaryExpression"; + _UnaryExpression: void; + argument: Expression; + operator: UnaryOperator; + prefix: true; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; type UpdateOperator = "++" | "--"; export type UpdateExpression = { - type: "UpdateExpression", - _UpdateExpression: void, - argument: Expression, - operator: UpdateOperator, - prefix: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "UpdateExpression"; + _UpdateExpression: void; + argument: Expression; + operator: UpdateOperator; + prefix: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type VariableDeclaration = { - type: "VariableDeclaration", - _VariableDeclaration: void, - declarations: Array, - kind: "var" | "let" | "const", - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "VariableDeclaration"; + _VariableDeclaration: void; + declarations: Array; + kind: "var" | "let" | "const"; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type VariableDeclarator = { - type: "VariableDeclarator", - _VariableDeclarator: void, - id: Pattern, - init: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "VariableDeclarator"; + _VariableDeclarator: void; + id: Pattern; + init: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type WhileStatement = { - type: "WhileStatement", - _WhileStatement: void, - body: Statement, - test: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "WhileStatement"; + _WhileStatement: void; + body: Statement; + test: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type WithStatement = { - type: "WithStatement", - _WithStatement: void, - body: Statement, - object: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "WithStatement"; + _WithStatement: void; + body: Statement; + object: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type YieldExpression = { - type: "YieldExpression", - _YieldExpression: void, - argument: ?Expression, - delegate: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "YieldExpression"; + _YieldExpression: void; + argument: ?Expression; + delegate: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ExportAllDeclaration = { - type: "ExportAllDeclaration", - _ExportAllDeclaration: void, - exported: Node, - source: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExportAllDeclaration"; + _ExportAllDeclaration: void; + exported: Node; + source: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ExportDefaultDeclaration = { - type: "ExportDefaultDeclaration", - _ExportDefaultDeclaration: void, - declaration: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExportDefaultDeclaration"; + _ExportDefaultDeclaration: void; + declaration: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ExportNamedDeclaration = { - type: "ExportNamedDeclaration", - _ExportNamedDeclaration: void, - declaration: Node, - source: Literal, - specifiers: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExportNamedDeclaration"; + _ExportNamedDeclaration: void; + declaration: Node; + source: Literal; + specifiers: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ExportDefaultSpecifier = { - type: "ExportDefaultSpecifier", - _ExportDefaultSpecifier: void, - exported: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExportDefaultSpecifier"; + _ExportDefaultSpecifier: void; + exported: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ExportNamespaceSpecifier = { - type: "ExportNamespaceSpecifier", - _ExportNamespaceSpecifier: void, - exported: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExportNamespaceSpecifier"; + _ExportNamespaceSpecifier: void; + exported: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ExportSpecifier = { - type: "ExportSpecifier", - _ExportSpecifier: void, - local: Node, - exported: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ExportSpecifier"; + _ExportSpecifier: void; + local: Node; + exported: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type AnyTypeAnnotation = { - type: "AnyTypeAnnotation", - _AnyTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "AnyTypeAnnotation"; + _AnyTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ArrayTypeAnnotation = { - type: "ArrayTypeAnnotation", - _ArrayTypeAnnotation: void, - elementType: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ArrayTypeAnnotation"; + _ArrayTypeAnnotation: void; + elementType: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type BooleanLiteralTypeAnnotation = { - type: "BooleanLiteralTypeAnnotation", - _BooleanLiteralTypeAnnotation: void, - raw: string, - value: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BooleanLiteralTypeAnnotation"; + _BooleanLiteralTypeAnnotation: void; + raw: string; + value: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type BooleanTypeAnnotation = { - type: "BooleanTypeAnnotation", - _BooleanTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "BooleanTypeAnnotation"; + _BooleanTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ClassImplements = { - type: "ClassImplements", - _ClassImplements: void, - id: Identifier, - typeParameters: ?TypeParameterInstantiation, - superClass: ?Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassImplements"; + _ClassImplements: void; + id: Identifier; + typeParameters: ?TypeParameterInstantiation; + superClass: ?Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ClassProperty = { - type: "ClassProperty", - _ClassProperty: void, - computed: boolean, - key: Node, - static: boolean, - typeAnnotation: ?TypeAnnotation, - value: ?Expression, - decorators: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ClassProperty"; + _ClassProperty: void; + computed: boolean; + key: Node; + static: boolean; + typeAnnotation: ?TypeAnnotation; + value: ?Expression; + decorators: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type DeclareClass = { - type: "DeclareClass", - _DeclareClass: void, - body: ObjectTypeAnnotation, - extends: Array, - id: Identifier, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareClass"; + _DeclareClass: void; + body: ObjectTypeAnnotation; + extends: Array; + id: Identifier; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type DeclareFunction = { - type: "DeclareFunction", - _DeclareFunction: void, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareFunction"; + _DeclareFunction: void; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type DeclareModule = { - type: "DeclareModule", - _DeclareModule: void, - body: BlockStatement, - id: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareModule"; + _DeclareModule: void; + body: BlockStatement; + id: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type DeclareVariable = { - type: "DeclareVariable", - _DeclareVariable: void, - id: Identifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "DeclareVariable"; + _DeclareVariable: void; + id: Identifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type FunctionTypeAnnotation = { - type: "FunctionTypeAnnotation", - _FunctionTypeAnnotation: void, - params: Array, - rest: ?FunctionTypeParam, - returnType: Type, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionTypeAnnotation"; + _FunctionTypeAnnotation: void; + params: Array; + rest: ?FunctionTypeParam; + returnType: Type; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type FunctionTypeParam = { - type: "FunctionTypeParam", - _FunctionTypeParam: void, - name: Identifier, - optional: boolean, - typeAnnotation: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "FunctionTypeParam"; + _FunctionTypeParam: void; + name: Identifier; + optional: boolean; + typeAnnotation: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type GenericTypeAnnotation = { - type: "GenericTypeAnnotation", - _GenericTypeAnnotation: void, - id: Node, - typeParameters: ?TypeParameterInstantiation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "GenericTypeAnnotation"; + _GenericTypeAnnotation: void; + id: Node; + typeParameters: ?TypeParameterInstantiation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type InterfaceExtends = { - type: "InterfaceExtends", - _InterfaceExtends: void, - id: Identifier, - typeParameters: ?TypeParameterInstantiation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "InterfaceExtends"; + _InterfaceExtends: void; + id: Identifier; + typeParameters: ?TypeParameterInstantiation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type InterfaceDeclaration = { - type: "InterfaceDeclaration", - _InterfaceDeclaration: void, - body: ObjectTypeAnnotation, - extends: Array, - id: Identifier, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "InterfaceDeclaration"; + _InterfaceDeclaration: void; + body: ObjectTypeAnnotation; + extends: Array; + id: Identifier; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type IntersectionTypeAnnotation = { - type: "IntersectionTypeAnnotation", - _IntersectionTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "IntersectionTypeAnnotation"; + _IntersectionTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type MixedTypeAnnotation = { - type: "MixedTypeAnnotation", - _MixedTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "MixedTypeAnnotation"; + _MixedTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type NullableTypeAnnotation = { - type: "NullableTypeAnnotation", - _NullableTypeAnnotation: void, - typeAnnotation: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NullableTypeAnnotation"; + _NullableTypeAnnotation: void; + typeAnnotation: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type NumberLiteralTypeAnnotation = { - type: "NumberLiteralTypeAnnotation", - _NumberLiteralTypeAnnotation: void, - raw: string, - value: number, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NumberLiteralTypeAnnotation"; + _NumberLiteralTypeAnnotation: void; + raw: string; + value: number; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type NumberTypeAnnotation = { - type: "NumberTypeAnnotation", - _NumberTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "NumberTypeAnnotation"; + _NumberTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type StringLiteralTypeAnnotation = { - type: "StringLiteralTypeAnnotation", - _StringLiteralTypeAnnotation: void, - raw: string, - value: string, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "StringLiteralTypeAnnotation"; + _StringLiteralTypeAnnotation: void; + raw: string; + value: string; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type StringTypeAnnotation = { - type: "StringTypeAnnotation", - _StringTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "StringTypeAnnotation"; + _StringTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TupleTypeAnnotation = { - type: "TupleTypeAnnotation", - _TupleTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TupleTypeAnnotation"; + _TupleTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TypeofTypeAnnotation = { - type: "TypeofTypeAnnotation", - _TypeofTypeAnnotation: void, - argument: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeofTypeAnnotation"; + _TypeofTypeAnnotation: void; + argument: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TypeAlias = { - type: "TypeAlias", - _TypeAlias: void, - id: Identifier, - right: Type, - typeParameters: ?TypeParameterDeclaration, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeAlias"; + _TypeAlias: void; + id: Identifier; + right: Type; + typeParameters: ?TypeParameterDeclaration; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TypeAnnotation = { - type: "TypeAnnotation", - _TypeAnnotation: void, - typeAnnotation: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeAnnotation"; + _TypeAnnotation: void; + typeAnnotation: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TypeCastExpression = { - type: "TypeCastExpression", - _TypeCastExpression: void, - expression: Expression, - typeAnnotation: TypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeCastExpression"; + _TypeCastExpression: void; + expression: Expression; + typeAnnotation: TypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TypeParameterDeclaration = { - type: "TypeParameterDeclaration", - _TypeParameterDeclaration: void, - params: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeParameterDeclaration"; + _TypeParameterDeclaration: void; + params: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type TypeParameterInstantiation = { - type: "TypeParameterInstantiation", - _TypeParameterInstantiation: void, - params: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "TypeParameterInstantiation"; + _TypeParameterInstantiation: void; + params: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ObjectTypeAnnotation = { - type: "ObjectTypeAnnotation", - _ObjectTypeAnnotation: void, - callProperties: Array, - indexers: Array, - properties: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectTypeAnnotation"; + _ObjectTypeAnnotation: void; + callProperties: Array; + indexers: Array; + properties: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ObjectTypeCallProperty = { - type: "ObjectTypeCallProperty", - _ObjectTypeCallProperty: void, - static: boolean, - value: FunctionTypeAnnotation, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectTypeCallProperty"; + _ObjectTypeCallProperty: void; + static: boolean; + value: FunctionTypeAnnotation; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ObjectTypeIndexer = { - type: "ObjectTypeIndexer", - _ObjectTypeIndexer: void, - id: Identifier, - key: Type, - value: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectTypeIndexer"; + _ObjectTypeIndexer: void; + id: Identifier; + key: Type; + value: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type ObjectTypeProperty = { - type: "ObjectTypeProperty", - _ObjectTypeProperty: void, - key: Node, - optional: boolean, - value: Type, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "ObjectTypeProperty"; + _ObjectTypeProperty: void; + key: Node; + optional: boolean; + value: Type; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type QualifiedTypeIdentifier = { - type: "QualifiedTypeIdentifier", - _QualifiedTypeIdentifier: void, - id: Identifier, - qualification: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "QualifiedTypeIdentifier"; + _QualifiedTypeIdentifier: void; + id: Identifier; + qualification: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type UnionTypeAnnotation = { - type: "UnionTypeAnnotation", - _UnionTypeAnnotation: void, - types: Array, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "UnionTypeAnnotation"; + _UnionTypeAnnotation: void; + types: Array; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type VoidTypeAnnotation = { - type: "VoidTypeAnnotation", - _VoidTypeAnnotation: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "VoidTypeAnnotation"; + _VoidTypeAnnotation: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXAttribute = { - type: "JSXAttribute", - _JSXAttribute: void, - name: Node, - value: ?Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXAttribute"; + _JSXAttribute: void; + name: Node; + value: ?Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXClosingElement = { - type: "JSXClosingElement", - _JSXClosingElement: void, - name: Node, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXClosingElement"; + _JSXClosingElement: void; + name: Node; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXElement = { - type: "JSXElement", - _JSXElement: void, - children: Array, - closingElement: ?JSXClosingElement, - openingElement: JSXOpeningElement, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXElement"; + _JSXElement: void; + children: Array; + closingElement: ?JSXClosingElement; + openingElement: JSXOpeningElement; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXEmptyExpression = { - type: "JSXEmptyExpression", - _JSXEmptyExpression: void, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXEmptyExpression"; + _JSXEmptyExpression: void; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXExpressionContainer = { - type: "JSXExpressionContainer", - _JSXExpressionContainer: void, - expression: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXExpressionContainer"; + _JSXExpressionContainer: void; + expression: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXIdentifier = { - type: "JSXIdentifier", - _JSXIdentifier: void, - name: string, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXIdentifier"; + _JSXIdentifier: void; + name: string; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXMemberExpression = { - type: "JSXMemberExpression", - _JSXMemberExpression: void, - computed: boolean, - object: Node, - property: JSXIdentifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXMemberExpression"; + _JSXMemberExpression: void; + computed: boolean; + object: Node; + property: JSXIdentifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXNamespacedName = { - type: "JSXNamespacedName", - _JSXNamespacedName: void, - name: JSXIdentifier, - namespace: JSXIdentifier, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXNamespacedName"; + _JSXNamespacedName: void; + name: JSXIdentifier; + namespace: JSXIdentifier; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXOpeningElement = { - type: "JSXOpeningElement", - _JSXOpeningElement: void, - attributes: Array, - name: Array, - selfClosing: boolean, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXOpeningElement"; + _JSXOpeningElement: void; + attributes: Array; + name: Array; + selfClosing: boolean; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; export type JSXSpreadAttribute = { - type: "JSXSpreadAttribute", - _JSXSpreadAttribute: void, - argument: Expression, - end: number, - innerComments: ?Array, - leadingComments: ?Array, + type: "JSXSpreadAttribute"; + _JSXSpreadAttribute: void; + argument: Expression; + end: number; + innerComments: ?Array; + leadingComments: ?Array; loc: { - end: { column: number, line: number }, - start: { column: number, line: number } - }, - start: number, + end: { column: number; line: number }; + start: { column: number; line: number } + }; + start: number; trailingComments: ?Array }; " diff --git a/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap b/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap index bce4bf8c5..7a88908cc 100644 --- a/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_args_nonstrict/__snapshots__/jsfmt.spec.js.snap @@ -33,7 +33,7 @@ class MyClass2 { } } -var c2: MyClass2 = new MyClass2(0, \"\"); // no error +var c2: MyClass2 = new MyClass2(0, ""); // no error // no arity error in type annotation using polymorphic type alias @@ -112,11 +112,11 @@ class MyClass2 { this.y = y; } } -var c2: MyClass2 = new MyClass2(0, \"\"); +var c2: MyClass2 = new MyClass2(0, ""); type MyObject = { x: T }; var o: MyObject = { x: 0 }; type MySubobject = { y: number } & MyObject; -interface MyInterface extends { x: T } +interface MyInterface { x: T } interface MySubinterface extends MyInterface { y: number } class MySubclass extends MyClass { y: number; diff --git a/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap b/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap index 2c177c2c0..a59f5c453 100644 --- a/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_args_strict/__snapshots__/jsfmt.spec.js.snap @@ -32,7 +32,7 @@ class MyClass2 { } } -var c2: MyClass2 = new MyClass2(0, \"\"); // error, missing argument list (1-2) +var c2: MyClass2 = new MyClass2(0, ""); // error, missing argument list (1-2) // arity error in type annotation using polymorphic type alias @@ -110,11 +110,11 @@ class MyClass2 { this.y = y; } } -var c2: MyClass2 = new MyClass2(0, \"\"); +var c2: MyClass2 = new MyClass2(0, ""); type MyObject = { x: T }; var o: MyObject = { x: 0 }; type MySubobject = { y: number } & MyObject; -interface MyInterface extends { x: T } +interface MyInterface { x: T } interface MySubinterface extends MyInterface { y: number } class MySubclass extends MyClass { y: number; diff --git a/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap b/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap index 79c6e8cf8..25a97594c 100644 --- a/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_only_vars/__snapshots__/jsfmt.spec.js.snap @@ -28,33 +28,33 @@ exports[`test bad_shadowing.js 1`] = ` * @flow */ -import typeof A from \"./A.js\"; -import type {Foo, Bar as Baz} from \"./A.js\"; +import typeof A from "./A.js"; +import type {Foo, Bar as Baz} from "./A.js"; type duck = { quack: () => string; } // These string types should confict with the imported types -var A: string = \"Hello\"; -var Foo: string = \"Goodbye\"; -var Baz: string = \"Go away please\"; +var A: string = "Hello"; +var Foo: string = "Goodbye"; +var Baz: string = "Go away please"; // This string type should conflict with the typedef -var duck: string = \"quack\"; +var duck: string = "quack"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow */ // These string types should confict with the imported types // This string type should conflict with the typedef -import typeof A from \"./A.js\"; -import type { Foo, Bar as Baz } from \"./A.js\"; -type duck = { quack: : () => string }; -var A: string = \"Hello\"; -var Foo: string = \"Goodbye\"; -var Baz: string = \"Go away please\"; -var duck: string = \"quack\"; +import typeof A from "./A.js"; +import type { Foo, Bar as Baz } from "./A.js"; +type duck = { quack(): string }; +var A: string = "Hello"; +var Foo: string = "Goodbye"; +var Baz: string = "Go away please"; +var duck: string = "quack"; " `; @@ -63,10 +63,10 @@ exports[`test good_shadowing.js 1`] = ` * @flow */ -import typeof A from \"./A.js\"; -import type {Foo, Bar as Baz} from \"./A.js\"; +import typeof A from "./A.js"; +import type {Foo, Bar as Baz} from "./A.js"; -var A = require(\'./A.js\'); +var A = require('./A.js'); var Foo = A.Foo; var Baz = A.Bar; @@ -85,9 +85,9 @@ var b: Foo = new A.Foo(); */ // errors in prev block leave type bindings in place, so these are errors // errors from value positions only -import typeof A from \"./A.js\"; -import type { Foo, Bar as Baz } from \"./A.js\"; -var A = require(\"./A.js\"); +import typeof A from "./A.js"; +import type { Foo, Bar as Baz } from "./A.js"; +var A = require("./A.js"); var Foo = A.Foo; var Baz = A.Bar; var m = A; @@ -104,12 +104,12 @@ exports[`test import_type.js 1`] = ` * @flow */ -import typeof A from \"./A.js\"; -import type {Foo, Bar as Baz} from \"./A.js\"; +import typeof A from "./A.js"; +import type {Foo, Bar as Baz} from "./A.js"; -var actualA = require(\'./A.js\'); +var actualA = require('./A.js'); -// You can\'t use it as an identifier +// You can't use it as an identifier var m = A; var n = Foo; var o = Baz; @@ -121,11 +121,11 @@ var a: Foo = new actualA.Foo(); /** * @flow */ -// You can\'t use it as an identifier +// You can't use it as an identifier // But using it in a type should still work -import typeof A from \"./A.js\"; -import type { Foo, Bar as Baz } from \"./A.js\"; -var actualA = require(\"./A.js\"); +import typeof A from "./A.js"; +import type { Foo, Bar as Baz } from "./A.js"; +var actualA = require("./A.js"); var m = A; var n = Foo; var o = Baz; @@ -141,7 +141,7 @@ exports[`test type_alias.js 1`] = ` type Foo = number; -// You can\'t use it as an identifier +// You can't use it as an identifier var x = Foo; // But using it in a type should still work @@ -152,7 +152,7 @@ type c = Foo; /** * @flow */ -// You can\'t use it as an identifier +// You can't use it as an identifier // But using it in a type should still work type Foo = number; var x = Foo; diff --git a/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap index 913a7d628..c4689042c 100644 --- a/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_defaults/__snapshots__/jsfmt.spec.js.snap @@ -13,7 +13,7 @@ class B extends A {} var b_number: B = new B(123); var b_void: B = new B(); -var b_default: B<> = new B(\'hello\'); +var b_default: B<> = new B('hello'); var b_star: B<*> = new B(123); @@ -27,8 +27,8 @@ class C extends A {} var c_number: C = new C(123); // Error number ~> ?string var c_void: C = new C(); -var c_default: C<> = new C(\'hello\'); -var c_star: C<*> = new C(\'hello\'); +var c_default: C<> = new C('hello'); +var c_star: C<*> = new C('hello'); (c_void.p: boolean); // Error void ~> boolean (c_default.p: boolean); // Error string ~> boolean @@ -37,9 +37,9 @@ var c_star: C<*> = new C(\'hello\'); class D extends A {} var d_number: D = new D(123); var d_void: D = new D(); -var d_default: D = new D(\'hello\'); -var d_too_few_args: D<> = new D(\'hello\'); // Error too few tparams -var d_too_many: D = new D(\'hello\'); // Error too many tparams +var d_default: D = new D('hello'); +var d_too_few_args: D<> = new D('hello'); // Error too few tparams +var d_too_many: D = new D('hello'); // Error too many tparams var d_star: D<*> = new D(10); // error, number ~> string (d_number.p: boolean); // Error number ~> boolean @@ -52,18 +52,18 @@ class F {} // Error: number ~> string class G extends A {} -var g_default: G = new G(\'hello\'); +var g_default: G = new G('hello'); (g_default.p: boolean); // Error string ~> boolean -class H {} // Error - can\'t refer to T before it\'s defined +class H {} // Error - can't refer to T before it's defined class I extends A {} var i_number: I = new I(123); // Error number ~> ?string var i_void: I = new I(); -var i_default: I<> = new I(\'hello\'); -var i_star: I<*> = new I(\'hello\'); +var i_default: I<> = new I('hello'); +var i_star: I<*> = new I('hello'); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // Test out simple defaults @@ -85,7 +85,7 @@ var i_star: I<*> = new I(\'hello\'); // Error: string ~> number // Error: number ~> string // Error string ~> boolean -// Error - can\'t refer to T before it\'s defined +// Error - can't refer to T before it's defined // Error number ~> ?string class A { p: T; @@ -96,7 +96,7 @@ class A { class B extends A {} var b_number: B = new B(123); var b_void: B = new B(); -var b_default: B<> = new B(\"hello\"); +var b_default: B<> = new B("hello"); var b_star: B<*> = new B(123); (b_number.p: boolean); (b_void.p: boolean); @@ -105,17 +105,17 @@ var b_star: B<*> = new B(123); class C extends A {} var c_number: C = new C(123); var c_void: C = new C(); -var c_default: C<> = new C(\"hello\"); -var c_star: C<*> = new C(\"hello\"); +var c_default: C<> = new C("hello"); +var c_star: C<*> = new C("hello"); (c_void.p: boolean); (c_default.p: boolean); (c_star.p: boolean); class D extends A {} var d_number: D = new D(123); var d_void: D = new D(); -var d_default: D = new D(\"hello\"); -var d_too_few_args: D<> = new D(\"hello\"); -var d_too_many: D = new D(\"hello\"); +var d_default: D = new D("hello"); +var d_too_few_args: D<> = new D("hello"); +var d_too_many: D = new D("hello"); var d_star: D<*> = new D(10); (d_number.p: boolean); (d_void.p: boolean); @@ -124,13 +124,13 @@ var d_star: D<*> = new D(10); class E {} class F {} class G extends A {} -var g_default: G = new G(\"hello\"); +var g_default: G = new G("hello"); (g_default.p: boolean); class H {} class I extends A {} var i_number: I = new I(123); var i_void: I = new I(); -var i_default: I<> = new I(\"hello\"); -var i_star: I<*> = new I(\"hello\"); +var i_default: I<> = new I("hello"); +var i_star: I<*> = new I("hello"); " `; diff --git a/tests/type_param_scope/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_scope/__snapshots__/jsfmt.spec.js.snap index 4d29d00e5..89ffdc8ff 100644 --- a/tests/type_param_scope/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_scope/__snapshots__/jsfmt.spec.js.snap @@ -139,10 +139,10 @@ class B extends A { return new B(x); } } -interface C extends { m: : (x: T) => C } -interface D extends C { m: : (x: T) => D } -declare class E { m: : (x: T) => E } -declare class F { m: : (x: T) => F } +interface C { m(x: T): C } +interface D extends C { m(x: T): D } +declare class E { m(x: T): E } +declare class F extends E { m(x: T): F } class G { x: T; constructor(x: T) { diff --git a/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap index 185e5603e..651af2015 100644 --- a/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_variance/__snapshots__/jsfmt.spec.js.snap @@ -5,7 +5,7 @@ exports[`test promise.js 1`] = ` * which is covariant. * * Explicit variance control via annotation is coming, - * but not immediately. In the meantime, Promise\'s + * but not immediately. In the meantime, Promise's * participation in async/await makes certain kinds of * errors onerous (and nonobvious) without covariance. * @@ -14,7 +14,7 @@ exports[`test promise.js 1`] = ` async function foo(x: boolean): Promise { if (x) { - return {bar: \'baz\'}; // OK, because of covariant type param + return {bar: 'baz'}; // OK, because of covariant type param } else { return null; } @@ -33,7 +33,7 @@ run() * which is covariant. * * Explicit variance control via annotation is coming, - * but not immediately. In the meantime, Promise\'s + * but not immediately. In the meantime, Promise's * participation in async/await makes certain kinds of * errors onerous (and nonobvious) without covariance. * @@ -42,7 +42,7 @@ run() // OK, because of covariant type param async function foo(x: boolean): Promise { if (x) { - return { bar: \"baz\" }; + return { bar: "baz" }; } else { return null; } diff --git a/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap index adc9efec7..53839b61e 100644 --- a/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_variance2/__snapshots__/jsfmt.spec.js.snap @@ -11,7 +11,7 @@ exports[`test promise.js 1`] = ` async function foo(x: boolean): Promise { if (x) { - return {bar: \'baz\'}; // OK, because of covariant type param + return {bar: 'baz'}; // OK, because of covariant type param } else { return null; } @@ -36,7 +36,7 @@ run() // OK, because of covariant type param async function foo(x: boolean): Promise { if (x) { - return { bar: \"baz\" }; + return { bar: "baz" }; } else { return null; } diff --git a/tests/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap b/tests/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap index 0e9e6210c..1a9e0152f 100644 --- a/tests/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap +++ b/tests/type_param_variance2/libs/__snapshots__/jsfmt.spec.js.snap @@ -54,18 +54,23 @@ declare class Promise { // Any definitions here will override similarly-named ones in // library files declared earlier, including default flow libs. // Non-standard APIs -declare class Promise { - constructor: : (callback: (resolve: (result?: Promise | R) => void, reject: (error?: any) => void) => void) => void, - then: : (onFulfill?: ?: (value: R) => Promise | ?U, onReject?: ?: (error: any) => Promise | ?U) => Promise, - done: : (onFulfill?: ?: (value: R) => void, onReject?: ?: (error: any) => void) => void, - catch: : (onReject?: (error: any) => ?Promise | U) => Promise, - resolve: : (object?: Promise | T) => Promise, - reject: : (error?: any) => Promise, - finally: : (onSettled?: ?: (value: any) => Promise | U) => Promise, - cast: : (object?: T) => Promise, - all: : (promises: Array | T>) => Promise>, - race: : (promises: Array>) => Promise, - allObject: : (promisesByKey: T) => Promise<{ [key: $Keys]: any }> +declare class Promise { + constructor(callback: (resolve: (result?: Promise | R) => void, + reject: (error?: any) => void) => void): void; + then(onFulfill?: ?(value: R) => Promise | ?U, + onReject?: ?(error: any) => Promise | ?U): Promise; + done(onFulfill?: ?(value: R) => void, + onReject?: ?(error: any) => void): void; + catch(onReject?: (error: any) => ?Promise | U): Promise; + static resolve(object?: Promise | T): Promise; + static reject(error?: any): Promise; + finally(onSettled?: ?(value: any) => Promise | U): Promise; + static cast(object?: T): Promise; + static all(promises: Array | T>): Promise>; + static race(promises: Array>): Promise; + static allObject(promisesByKey: T): Promise<{ + [key: $Keys]: any + }> } " `; diff --git a/tests/typeapp_perf/__snapshots__/jsfmt.spec.js.snap b/tests/typeapp_perf/__snapshots__/jsfmt.spec.js.snap index b0cf041d7..ac550c7e6 100644 --- a/tests/typeapp_perf/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typeapp_perf/__snapshots__/jsfmt.spec.js.snap @@ -24,15 +24,15 @@ declare var b: B; * this test is taking a very long time to complete, there is a bug. */ class A {} type B = A & { - +a: : () => B, - +b: : () => B, - +c: : () => B, - +d: : () => B, - +e: : () => B, - +f: : () => B, - +g: : () => B, - +h: : () => B, - +i: : () => B + +a: () => B; + +b: () => B; + +c: () => B; + +d: () => B; + +e: () => B; + +f: () => B; + +g: () => B; + +h: () => B; + +i: () => B }; declare var b: B; (b: B); @@ -65,15 +65,15 @@ declare var b: B; * this test is taking a very long time to complete, there is a bug. */ class A {} type B = A & { - +a: : (x: B) => void, - +b: : (x: B) => void, - +c: : (x: B) => void, - +d: : (x: B) => void, - +e: : (x: B) => void, - +f: : (x: B) => void, - +g: : (x: B) => void, - +h: : (x: B) => void, - +i: : (x: B) => void + +a: (x: B) => void; + +b: (x: B) => void; + +c: (x: B) => void; + +d: (x: B) => void; + +e: (x: B) => void; + +f: (x: B) => void; + +g: (x: B) => void; + +h: (x: B) => void; + +i: (x: B) => void }; declare var b: B; (b: B); diff --git a/tests/typecast/__snapshots__/jsfmt.spec.js.snap b/tests/typecast/__snapshots__/jsfmt.spec.js.snap index 28c077333..5a58aa1bd 100644 --- a/tests/typecast/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typecast/__snapshots__/jsfmt.spec.js.snap @@ -5,16 +5,16 @@ exports[`test typecast.js 1`] = ` var tests = [ () => { // erroneous typcasts raise errors... - var n = (\"hey\" : number); - // ...but \'any\' does dynamic downcasts, if you must - var x: number = (\"hey\": any); - var y = ((\"hey\": any): number); + var n = ("hey" : number); + // ...but 'any' does dynamic downcasts, if you must + var x: number = ("hey": any); + var y = (("hey": any): number); }, () => { // typecasts in sequences // (parens always required around typecasts) - var s: string = ((0: number), (\"hey\": string)); + var s: string = ((0: number), ("hey": string)); }, () => { @@ -30,7 +30,7 @@ var tests = [ * Copyright 2004-present Facebook. All Rights Reserved. */ // erroneous typcasts raise errors... -// ...but \'any\' does dynamic downcasts, if you must +// ...but 'any' does dynamic downcasts, if you must // typecasts in sequences // (parens always required around typecasts) // TODO pending array element inference issues @@ -40,12 +40,12 @@ var tests = [ // var b = [(0 : ?number), 1, 2, 3, 4, 5, 6, 7, null]; var tests = [ () => { - var n = (\"hey\": number); - var x: number = (\"hey\": any); - var y = ((\"hey\": any): number); + var n = ("hey": number); + var x: number = ("hey": any); + var y = (("hey": any): number); }, () => { - var s: string = ((0: number), (\"hey\": string)); + var s: string = ((0: number), ("hey": string)); }, () => { diff --git a/tests/typeof/__snapshots__/jsfmt.spec.js.snap b/tests/typeof/__snapshots__/jsfmt.spec.js.snap index 59a90c9ed..05ea3f390 100644 --- a/tests/typeof/__snapshots__/jsfmt.spec.js.snap +++ b/tests/typeof/__snapshots__/jsfmt.spec.js.snap @@ -23,7 +23,7 @@ var a: MyClass1 = new MyClass1(); // of the class value itself with the type of its // instances. -// Aside: it\'s worth staring at the following (correct) +// Aside: it's worth staring at the following (correct) // type annotations until they make sense: // // MyClass1 : Class @@ -59,7 +59,7 @@ var c: typeof MyClass2 = new MyClass2(); var numValue:number = 42; var d: typeof numValue = 100; -var e: typeof numValue = \'asdf\'; // Error: string ~> number +var e: typeof numValue = 'asdf'; // Error: string ~> number ///////////////////////////////// // == typeof <> == // @@ -69,18 +69,18 @@ type numberAlias = number; // This is an error because typeof takes a value, not // a type, as an argument. However, the current error -// is suboptimal - just \'cannot resolve name\'. TODO. +// is suboptimal - just 'cannot resolve name'. TODO. // -var f: typeof numberAlias = 42; // Error: \'typeof <>\' makes no sense... +var f: typeof numberAlias = 42; // Error: 'typeof <>' makes no sense... /** * Use of a non-class/non-function value in type annotation. * These provoke a specific error, not just the generic - * \"type is incompatible\" + * "type is incompatible" */ - var Map = { \"A\": \"this is A\", \"B\": \"this is B\", \"C\": \"this is C\" }; - var keys: $Keys = \"A\"; // Error: ineligible value used in type anno + var Map = { "A": "this is A", "B": "this is B", "C": "this is C" }; + var keys: $Keys = "A"; // Error: ineligible value used in type anno ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * @flow @@ -97,7 +97,7 @@ var f: typeof numberAlias = 42; // Error: \'typeof <>\' makes no sen // Following tests are errors which conflate the type // of the class value itself with the type of its // instances. -// Aside: it\'s worth staring at the following (correct) +// Aside: it's worth staring at the following (correct) // type annotations until they make sense: // // MyClass1 : Class @@ -127,13 +127,13 @@ var f: typeof numberAlias = 42; // Error: \'typeof <>\' makes no sen ///////////////////////////////// // This is an error because typeof takes a value, not // a type, as an argument. However, the current error -// is suboptimal - just \'cannot resolve name\'. TODO. +// is suboptimal - just 'cannot resolve name'. TODO. // -// Error: \'typeof <>\' makes no sense... +// Error: 'typeof <>' makes no sense... /** * Use of a non-class/non-function value in type annotation. * These provoke a specific error, not just the generic - * \"type is incompatible\" + * "type is incompatible" */ // Error: ineligible value used in type anno class MyClass1 { @@ -151,10 +151,10 @@ class MyClass2 { var c: typeof MyClass2 = new MyClass2(); var numValue: number = 42; var d: typeof numValue = 100; -var e: typeof numValue = \"asdf\"; +var e: typeof numValue = "asdf"; type numberAlias = number; var f: typeof numberAlias = 42; -var Map = { \"A\": \"this is A\", \"B\": \"this is B\", \"C\": \"this is C\" }; -var keys: $Keys = \"A\"; +var Map = { "A": "this is A", "B": "this is B", "C": "this is C" }; +var keys: $Keys = "A"; " `; diff --git a/tests/unary/__snapshots__/jsfmt.spec.js.snap b/tests/unary/__snapshots__/jsfmt.spec.js.snap index 8caffa308..f6f051d03 100644 --- a/tests/unary/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unary/__snapshots__/jsfmt.spec.js.snap @@ -6,11 +6,11 @@ function x0(y: string): number { } function x1(y: string): number { - return -y; // error, we don\'t allow coercion here + return -y; // error, we don't allow coercion here } function x3(y: string) { - return ~y; // error, we don\'t allow coercion here + return ~y; // error, we don't allow coercion here } function x4(y: string): boolean { @@ -21,8 +21,8 @@ function x4(y: string): boolean { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ // ok, + exists solely for coercion -// error, we don\'t allow coercion here -// error, we don\'t allow coercion here +// error, we don't allow coercion here +// error, we don't allow coercion here // ok, coercion is allowed // error, number ~> void function x0(y: string): number { @@ -53,27 +53,27 @@ let tests = [ }, function(y: string) { - y++; // error, we don\'t allow coercion here + y++; // error, we don't allow coercion here (y: number); // ok, y is a number now - y++; // error, but you still can\'t write a number to a string + y++; // error, but you still can't write a number to a string }, function(y: string) { - y--; // error, we don\'t allow coercion here + y--; // error, we don't allow coercion here }, function(y: string) { - ++y; // error, we don\'t allow coercion here + ++y; // error, we don't allow coercion here }, function(y: string) { - --y; // error, we don\'t allow coercion here + --y; // error, we don't allow coercion here }, function() { const y = 123; - y++; // error, can\'t update const - y--; // error, can\'t update const + y++; // error, can't update const + y--; // error, can't update const }, function(y: any) { @@ -82,14 +82,14 @@ let tests = [ ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow -// error, we don\'t allow coercion here +// error, we don't allow coercion here // ok, y is a number now -// error, but you still can\'t write a number to a string -// error, we don\'t allow coercion here -// error, we don\'t allow coercion here -// error, we don\'t allow coercion here -// error, can\'t update const -// error, can\'t update const +// error, but you still can't write a number to a string +// error, we don't allow coercion here +// error, we don't allow coercion here +// error, we don't allow coercion here +// error, can't update const +// error, can't update const // ok let tests = [ function(y: number) { diff --git a/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap b/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap index c300345fe..26ce87e13 100644 --- a/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unchecked_haste_module_vs_lib/__snapshots__/jsfmt.spec.js.snap @@ -4,7 +4,7 @@ exports[`test buffer.js 1`] = ` * * Not in flow. * If this module is successfully imported/required, its - * type will be Any, so arbitraty uses won\'t cause errors. + * type will be Any, so arbitraty uses won't cause errors. * However, if a library module declaration is bound to * the same name as an unchecked module, it will be used * to satisfy imports/requires instead. @@ -17,7 +17,7 @@ export var INSPECT_MAX_BYTES = 0; * * Not in flow. * If this module is successfully imported/required, its - * type will be Any, so arbitraty uses won\'t cause errors. + * type will be Any, so arbitraty uses won't cause errors. * However, if a library module declaration is bound to * the same name as an unchecked module, it will be used * to satisfy imports/requires instead. @@ -32,27 +32,27 @@ exports[`test test.js 1`] = ` * @flow */ -/* \'buffer\' is the name of both an unchecked module in this directory, +/* 'buffer' is the name of both an unchecked module in this directory, * and a module declared in library file node.js. * If the require below resolves to the unchecked module, the mistyping * that follows will cause no errors, but if we resolve to the library - * instead, we\'ll get the desired error. + * instead, we'll get the desired error. */ -var buffer = require(\"buffer\"); +var buffer = require("buffer"); var x: string = buffer.INSPECT_MAX_BYTES; // error, number ~/> string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** * Copyright 2004-present Facebook. All Rights Reserved. * @flow */ -/* \'buffer\' is the name of both an unchecked module in this directory, +/* 'buffer' is the name of both an unchecked module in this directory, * and a module declared in library file node.js. * If the require below resolves to the unchecked module, the mistyping * that follows will cause no errors, but if we resolve to the library - * instead, we\'ll get the desired error. + * instead, we'll get the desired error. */ // error, number ~/> string -var buffer = require(\"buffer\"); +var buffer = require("buffer"); var x: string = buffer.INSPECT_MAX_BYTES; " `; diff --git a/tests/undefined/__snapshots__/jsfmt.spec.js.snap b/tests/undefined/__snapshots__/jsfmt.spec.js.snap index 6c3c24b9e..5eb709467 100644 --- a/tests/undefined/__snapshots__/jsfmt.spec.js.snap +++ b/tests/undefined/__snapshots__/jsfmt.spec.js.snap @@ -48,11 +48,11 @@ function foo() { x.foo(); } function bar() { - var x: ?{ bar: : () => void }; + var x: ?{ bar(): void }; if (x) x.bar(); } -function qux(x: number, y: string = \"\", z) { +function qux(x?: number, y: string = \"\", z) { } " diff --git a/tests/union-intersection/__snapshots__/jsfmt.spec.js.snap b/tests/union-intersection/__snapshots__/jsfmt.spec.js.snap index 5ae2341e5..2900ac4e6 100644 --- a/tests/union-intersection/__snapshots__/jsfmt.spec.js.snap +++ b/tests/union-intersection/__snapshots__/jsfmt.spec.js.snap @@ -4004,1006 +4004,1006 @@ type TAction = function foo(x: TAction): TAction { return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // perf test for big disjoint union with 1000 cases -type TAction = { type: \"a1\", a1: number } | { type: \"a2\", a1: number } | { - type: \"a3\", +type TAction = { type: \"a1\"; a1: number } | { type: \"a2\"; a1: number } | { + type: \"a3\"; a1: number -} | { type: \"a4\", a1: number } | { type: \"a5\", a1: number } | { - type: \"a6\", +} | { type: \"a4\"; a1: number } | { type: \"a5\"; a1: number } | { + type: \"a6\"; a1: number -} | { type: \"a7\", a1: number } | { type: \"a8\", a1: number } | { - type: \"a9\", +} | { type: \"a7\"; a1: number } | { type: \"a8\"; a1: number } | { + type: \"a9\"; a1: number -} | { type: \"a10\", a1: number } | { type: \"a11\", a2: number } | { - type: \"a12\", +} | { type: \"a10\"; a1: number } | { type: \"a11\"; a2: number } | { + type: \"a12\"; a2: number -} | { type: \"a13\", a2: number } | { type: \"a14\", a2: number } | { - type: \"a15\", +} | { type: \"a13\"; a2: number } | { type: \"a14\"; a2: number } | { + type: \"a15\"; a2: number -} | { type: \"a16\", a2: number } | { type: \"a17\", a2: number } | { - type: \"a18\", +} | { type: \"a16\"; a2: number } | { type: \"a17\"; a2: number } | { + type: \"a18\"; a2: number -} | { type: \"a19\", a2: number } | { type: \"a20\", a2: number } | { - type: \"a21\", +} | { type: \"a19\"; a2: number } | { type: \"a20\"; a2: number } | { + type: \"a21\"; a3: number -} | { type: \"a22\", a3: number } | { type: \"a23\", a3: number } | { - type: \"a24\", +} | { type: \"a22\"; a3: number } | { type: \"a23\"; a3: number } | { + type: \"a24\"; a3: number -} | { type: \"a25\", a3: number } | { type: \"a26\", a3: number } | { - type: \"a27\", +} | { type: \"a25\"; a3: number } | { type: \"a26\"; a3: number } | { + type: \"a27\"; a3: number -} | { type: \"a28\", a3: number } | { type: \"a29\", a3: number } | { - type: \"a30\", +} | { type: \"a28\"; a3: number } | { type: \"a29\"; a3: number } | { + type: \"a30\"; a3: number -} | { type: \"a31\", a4: number } | { type: \"a32\", a4: number } | { - type: \"a33\", +} | { type: \"a31\"; a4: number } | { type: \"a32\"; a4: number } | { + type: \"a33\"; a4: number -} | { type: \"a34\", a4: number } | { type: \"a35\", a4: number } | { - type: \"a36\", +} | { type: \"a34\"; a4: number } | { type: \"a35\"; a4: number } | { + type: \"a36\"; a4: number -} | { type: \"a37\", a4: number } | { type: \"a38\", a4: number } | { - type: \"a39\", +} | { type: \"a37\"; a4: number } | { type: \"a38\"; a4: number } | { + type: \"a39\"; a4: number -} | { type: \"a40\", a4: number } | { type: \"a41\", a5: number } | { - type: \"a42\", +} | { type: \"a40\"; a4: number } | { type: \"a41\"; a5: number } | { + type: \"a42\"; a5: number -} | { type: \"a43\", a5: number } | { type: \"a44\", a5: number } | { - type: \"a45\", +} | { type: \"a43\"; a5: number } | { type: \"a44\"; a5: number } | { + type: \"a45\"; a5: number -} | { type: \"a46\", a5: number } | { type: \"a47\", a5: number } | { - type: \"a48\", +} | { type: \"a46\"; a5: number } | { type: \"a47\"; a5: number } | { + type: \"a48\"; a5: number -} | { type: \"a49\", a5: number } | { type: \"a50\", a5: number } | { - type: \"a51\", +} | { type: \"a49\"; a5: number } | { type: \"a50\"; a5: number } | { + type: \"a51\"; a6: number -} | { type: \"a52\", a6: number } | { type: \"a53\", a6: number } | { - type: \"a54\", +} | { type: \"a52\"; a6: number } | { type: \"a53\"; a6: number } | { + type: \"a54\"; a6: number -} | { type: \"a55\", a6: number } | { type: \"a56\", a6: number } | { - type: \"a57\", +} | { type: \"a55\"; a6: number } | { type: \"a56\"; a6: number } | { + type: \"a57\"; a6: number -} | { type: \"a58\", a6: number } | { type: \"a59\", a6: number } | { - type: \"a60\", +} | { type: \"a58\"; a6: number } | { type: \"a59\"; a6: number } | { + type: \"a60\"; a6: number -} | { type: \"a61\", a7: number } | { type: \"a62\", a7: number } | { - type: \"a63\", +} | { type: \"a61\"; a7: number } | { type: \"a62\"; a7: number } | { + type: \"a63\"; a7: number -} | { type: \"a64\", a7: number } | { type: \"a65\", a7: number } | { - type: \"a66\", +} | { type: \"a64\"; a7: number } | { type: \"a65\"; a7: number } | { + type: \"a66\"; a7: number -} | { type: \"a67\", a7: number } | { type: \"a68\", a7: number } | { - type: \"a69\", +} | { type: \"a67\"; a7: number } | { type: \"a68\"; a7: number } | { + type: \"a69\"; a7: number -} | { type: \"a70\", a7: number } | { type: \"a71\", a8: number } | { - type: \"a72\", +} | { type: \"a70\"; a7: number } | { type: \"a71\"; a8: number } | { + type: \"a72\"; a8: number -} | { type: \"a73\", a8: number } | { type: \"a74\", a8: number } | { - type: \"a75\", +} | { type: \"a73\"; a8: number } | { type: \"a74\"; a8: number } | { + type: \"a75\"; a8: number -} | { type: \"a76\", a8: number } | { type: \"a77\", a8: number } | { - type: \"a78\", +} | { type: \"a76\"; a8: number } | { type: \"a77\"; a8: number } | { + type: \"a78\"; a8: number -} | { type: \"a79\", a8: number } | { type: \"a80\", a8: number } | { - type: \"a81\", +} | { type: \"a79\"; a8: number } | { type: \"a80\"; a8: number } | { + type: \"a81\"; a9: number -} | { type: \"a82\", a9: number } | { type: \"a83\", a9: number } | { - type: \"a84\", +} | { type: \"a82\"; a9: number } | { type: \"a83\"; a9: number } | { + type: \"a84\"; a9: number -} | { type: \"a85\", a9: number } | { type: \"a86\", a9: number } | { - type: \"a87\", +} | { type: \"a85\"; a9: number } | { type: \"a86\"; a9: number } | { + type: \"a87\"; a9: number -} | { type: \"a88\", a9: number } | { type: \"a89\", a9: number } | { - type: \"a90\", +} | { type: \"a88\"; a9: number } | { type: \"a89\"; a9: number } | { + type: \"a90\"; a9: number -} | { type: \"a91\", a10: number } | { type: \"a92\", a10: number } | { - type: \"a93\", +} | { type: \"a91\"; a10: number } | { type: \"a92\"; a10: number } | { + type: \"a93\"; a10: number -} | { type: \"a94\", a10: number } | { type: \"a95\", a10: number } | { - type: \"a96\", +} | { type: \"a94\"; a10: number } | { type: \"a95\"; a10: number } | { + type: \"a96\"; a10: number -} | { type: \"a97\", a10: number } | { type: \"a98\", a10: number } | { - type: \"a99\", +} | { type: \"a97\"; a10: number } | { type: \"a98\"; a10: number } | { + type: \"a99\"; a10: number -} | { type: \"a100\", a10: number } | { type: \"a101\", a11: number } | { - type: \"a102\", +} | { type: \"a100\"; a10: number } | { type: \"a101\"; a11: number } | { + type: \"a102\"; a11: number -} | { type: \"a103\", a11: number } | { type: \"a104\", a11: number } | { - type: \"a105\", +} | { type: \"a103\"; a11: number } | { type: \"a104\"; a11: number } | { + type: \"a105\"; a11: number -} | { type: \"a106\", a11: number } | { type: \"a107\", a11: number } | { - type: \"a108\", +} | { type: \"a106\"; a11: number } | { type: \"a107\"; a11: number } | { + type: \"a108\"; a11: number -} | { type: \"a109\", a11: number } | { type: \"a110\", a11: number } | { - type: \"a111\", +} | { type: \"a109\"; a11: number } | { type: \"a110\"; a11: number } | { + type: \"a111\"; a12: number -} | { type: \"a112\", a12: number } | { type: \"a113\", a12: number } | { - type: \"a114\", +} | { type: \"a112\"; a12: number } | { type: \"a113\"; a12: number } | { + type: \"a114\"; a12: number -} | { type: \"a115\", a12: number } | { type: \"a116\", a12: number } | { - type: \"a117\", +} | { type: \"a115\"; a12: number } | { type: \"a116\"; a12: number } | { + type: \"a117\"; a12: number -} | { type: \"a118\", a12: number } | { type: \"a119\", a12: number } | { - type: \"a120\", +} | { type: \"a118\"; a12: number } | { type: \"a119\"; a12: number } | { + type: \"a120\"; a12: number -} | { type: \"a121\", a13: number } | { type: \"a122\", a13: number } | { - type: \"a123\", +} | { type: \"a121\"; a13: number } | { type: \"a122\"; a13: number } | { + type: \"a123\"; a13: number -} | { type: \"a124\", a13: number } | { type: \"a125\", a13: number } | { - type: \"a126\", +} | { type: \"a124\"; a13: number } | { type: \"a125\"; a13: number } | { + type: \"a126\"; a13: number -} | { type: \"a127\", a13: number } | { type: \"a128\", a13: number } | { - type: \"a129\", +} | { type: \"a127\"; a13: number } | { type: \"a128\"; a13: number } | { + type: \"a129\"; a13: number -} | { type: \"a130\", a13: number } | { type: \"a131\", a14: number } | { - type: \"a132\", +} | { type: \"a130\"; a13: number } | { type: \"a131\"; a14: number } | { + type: \"a132\"; a14: number -} | { type: \"a133\", a14: number } | { type: \"a134\", a14: number } | { - type: \"a135\", +} | { type: \"a133\"; a14: number } | { type: \"a134\"; a14: number } | { + type: \"a135\"; a14: number -} | { type: \"a136\", a14: number } | { type: \"a137\", a14: number } | { - type: \"a138\", +} | { type: \"a136\"; a14: number } | { type: \"a137\"; a14: number } | { + type: \"a138\"; a14: number -} | { type: \"a139\", a14: number } | { type: \"a140\", a14: number } | { - type: \"a141\", +} | { type: \"a139\"; a14: number } | { type: \"a140\"; a14: number } | { + type: \"a141\"; a15: number -} | { type: \"a142\", a15: number } | { type: \"a143\", a15: number } | { - type: \"a144\", +} | { type: \"a142\"; a15: number } | { type: \"a143\"; a15: number } | { + type: \"a144\"; a15: number -} | { type: \"a145\", a15: number } | { type: \"a146\", a15: number } | { - type: \"a147\", +} | { type: \"a145\"; a15: number } | { type: \"a146\"; a15: number } | { + type: \"a147\"; a15: number -} | { type: \"a148\", a15: number } | { type: \"a149\", a15: number } | { - type: \"a150\", +} | { type: \"a148\"; a15: number } | { type: \"a149\"; a15: number } | { + type: \"a150\"; a15: number -} | { type: \"a151\", a16: number } | { type: \"a152\", a16: number } | { - type: \"a153\", +} | { type: \"a151\"; a16: number } | { type: \"a152\"; a16: number } | { + type: \"a153\"; a16: number -} | { type: \"a154\", a16: number } | { type: \"a155\", a16: number } | { - type: \"a156\", +} | { type: \"a154\"; a16: number } | { type: \"a155\"; a16: number } | { + type: \"a156\"; a16: number -} | { type: \"a157\", a16: number } | { type: \"a158\", a16: number } | { - type: \"a159\", +} | { type: \"a157\"; a16: number } | { type: \"a158\"; a16: number } | { + type: \"a159\"; a16: number -} | { type: \"a160\", a16: number } | { type: \"a161\", a17: number } | { - type: \"a162\", +} | { type: \"a160\"; a16: number } | { type: \"a161\"; a17: number } | { + type: \"a162\"; a17: number -} | { type: \"a163\", a17: number } | { type: \"a164\", a17: number } | { - type: \"a165\", +} | { type: \"a163\"; a17: number } | { type: \"a164\"; a17: number } | { + type: \"a165\"; a17: number -} | { type: \"a166\", a17: number } | { type: \"a167\", a17: number } | { - type: \"a168\", +} | { type: \"a166\"; a17: number } | { type: \"a167\"; a17: number } | { + type: \"a168\"; a17: number -} | { type: \"a169\", a17: number } | { type: \"a170\", a17: number } | { - type: \"a171\", +} | { type: \"a169\"; a17: number } | { type: \"a170\"; a17: number } | { + type: \"a171\"; a18: number -} | { type: \"a172\", a18: number } | { type: \"a173\", a18: number } | { - type: \"a174\", +} | { type: \"a172\"; a18: number } | { type: \"a173\"; a18: number } | { + type: \"a174\"; a18: number -} | { type: \"a175\", a18: number } | { type: \"a176\", a18: number } | { - type: \"a177\", +} | { type: \"a175\"; a18: number } | { type: \"a176\"; a18: number } | { + type: \"a177\"; a18: number -} | { type: \"a178\", a18: number } | { type: \"a179\", a18: number } | { - type: \"a180\", +} | { type: \"a178\"; a18: number } | { type: \"a179\"; a18: number } | { + type: \"a180\"; a18: number -} | { type: \"a181\", a19: number } | { type: \"a182\", a19: number } | { - type: \"a183\", +} | { type: \"a181\"; a19: number } | { type: \"a182\"; a19: number } | { + type: \"a183\"; a19: number -} | { type: \"a184\", a19: number } | { type: \"a185\", a19: number } | { - type: \"a186\", +} | { type: \"a184\"; a19: number } | { type: \"a185\"; a19: number } | { + type: \"a186\"; a19: number -} | { type: \"a187\", a19: number } | { type: \"a188\", a19: number } | { - type: \"a189\", +} | { type: \"a187\"; a19: number } | { type: \"a188\"; a19: number } | { + type: \"a189\"; a19: number -} | { type: \"a190\", a19: number } | { type: \"a191\", a20: number } | { - type: \"a192\", +} | { type: \"a190\"; a19: number } | { type: \"a191\"; a20: number } | { + type: \"a192\"; a20: number -} | { type: \"a193\", a20: number } | { type: \"a194\", a20: number } | { - type: \"a195\", +} | { type: \"a193\"; a20: number } | { type: \"a194\"; a20: number } | { + type: \"a195\"; a20: number -} | { type: \"a196\", a20: number } | { type: \"a197\", a20: number } | { - type: \"a198\", +} | { type: \"a196\"; a20: number } | { type: \"a197\"; a20: number } | { + type: \"a198\"; a20: number -} | { type: \"a199\", a20: number } | { type: \"a200\", a20: number } | { - type: \"a201\", +} | { type: \"a199\"; a20: number } | { type: \"a200\"; a20: number } | { + type: \"a201\"; a21: number -} | { type: \"a202\", a21: number } | { type: \"a203\", a21: number } | { - type: \"a204\", +} | { type: \"a202\"; a21: number } | { type: \"a203\"; a21: number } | { + type: \"a204\"; a21: number -} | { type: \"a205\", a21: number } | { type: \"a206\", a21: number } | { - type: \"a207\", +} | { type: \"a205\"; a21: number } | { type: \"a206\"; a21: number } | { + type: \"a207\"; a21: number -} | { type: \"a208\", a21: number } | { type: \"a209\", a21: number } | { - type: \"a210\", +} | { type: \"a208\"; a21: number } | { type: \"a209\"; a21: number } | { + type: \"a210\"; a21: number -} | { type: \"a211\", a22: number } | { type: \"a212\", a22: number } | { - type: \"a213\", +} | { type: \"a211\"; a22: number } | { type: \"a212\"; a22: number } | { + type: \"a213\"; a22: number -} | { type: \"a214\", a22: number } | { type: \"a215\", a22: number } | { - type: \"a216\", +} | { type: \"a214\"; a22: number } | { type: \"a215\"; a22: number } | { + type: \"a216\"; a22: number -} | { type: \"a217\", a22: number } | { type: \"a218\", a22: number } | { - type: \"a219\", +} | { type: \"a217\"; a22: number } | { type: \"a218\"; a22: number } | { + type: \"a219\"; a22: number -} | { type: \"a220\", a22: number } | { type: \"a221\", a23: number } | { - type: \"a222\", +} | { type: \"a220\"; a22: number } | { type: \"a221\"; a23: number } | { + type: \"a222\"; a23: number -} | { type: \"a223\", a23: number } | { type: \"a224\", a23: number } | { - type: \"a225\", +} | { type: \"a223\"; a23: number } | { type: \"a224\"; a23: number } | { + type: \"a225\"; a23: number -} | { type: \"a226\", a23: number } | { type: \"a227\", a23: number } | { - type: \"a228\", +} | { type: \"a226\"; a23: number } | { type: \"a227\"; a23: number } | { + type: \"a228\"; a23: number -} | { type: \"a229\", a23: number } | { type: \"a230\", a23: number } | { - type: \"a231\", +} | { type: \"a229\"; a23: number } | { type: \"a230\"; a23: number } | { + type: \"a231\"; a24: number -} | { type: \"a232\", a24: number } | { type: \"a233\", a24: number } | { - type: \"a234\", +} | { type: \"a232\"; a24: number } | { type: \"a233\"; a24: number } | { + type: \"a234\"; a24: number -} | { type: \"a235\", a24: number } | { type: \"a236\", a24: number } | { - type: \"a237\", +} | { type: \"a235\"; a24: number } | { type: \"a236\"; a24: number } | { + type: \"a237\"; a24: number -} | { type: \"a238\", a24: number } | { type: \"a239\", a24: number } | { - type: \"a240\", +} | { type: \"a238\"; a24: number } | { type: \"a239\"; a24: number } | { + type: \"a240\"; a24: number -} | { type: \"a241\", a25: number } | { type: \"a242\", a25: number } | { - type: \"a243\", +} | { type: \"a241\"; a25: number } | { type: \"a242\"; a25: number } | { + type: \"a243\"; a25: number -} | { type: \"a244\", a25: number } | { type: \"a245\", a25: number } | { - type: \"a246\", +} | { type: \"a244\"; a25: number } | { type: \"a245\"; a25: number } | { + type: \"a246\"; a25: number -} | { type: \"a247\", a25: number } | { type: \"a248\", a25: number } | { - type: \"a249\", +} | { type: \"a247\"; a25: number } | { type: \"a248\"; a25: number } | { + type: \"a249\"; a25: number -} | { type: \"a250\", a25: number } | { type: \"a251\", a26: number } | { - type: \"a252\", +} | { type: \"a250\"; a25: number } | { type: \"a251\"; a26: number } | { + type: \"a252\"; a26: number -} | { type: \"a253\", a26: number } | { type: \"a254\", a26: number } | { - type: \"a255\", +} | { type: \"a253\"; a26: number } | { type: \"a254\"; a26: number } | { + type: \"a255\"; a26: number -} | { type: \"a256\", a26: number } | { type: \"a257\", a26: number } | { - type: \"a258\", +} | { type: \"a256\"; a26: number } | { type: \"a257\"; a26: number } | { + type: \"a258\"; a26: number -} | { type: \"a259\", a26: number } | { type: \"a260\", a26: number } | { - type: \"a261\", +} | { type: \"a259\"; a26: number } | { type: \"a260\"; a26: number } | { + type: \"a261\"; a27: number -} | { type: \"a262\", a27: number } | { type: \"a263\", a27: number } | { - type: \"a264\", +} | { type: \"a262\"; a27: number } | { type: \"a263\"; a27: number } | { + type: \"a264\"; a27: number -} | { type: \"a265\", a27: number } | { type: \"a266\", a27: number } | { - type: \"a267\", +} | { type: \"a265\"; a27: number } | { type: \"a266\"; a27: number } | { + type: \"a267\"; a27: number -} | { type: \"a268\", a27: number } | { type: \"a269\", a27: number } | { - type: \"a270\", +} | { type: \"a268\"; a27: number } | { type: \"a269\"; a27: number } | { + type: \"a270\"; a27: number -} | { type: \"a271\", a28: number } | { type: \"a272\", a28: number } | { - type: \"a273\", +} | { type: \"a271\"; a28: number } | { type: \"a272\"; a28: number } | { + type: \"a273\"; a28: number -} | { type: \"a274\", a28: number } | { type: \"a275\", a28: number } | { - type: \"a276\", +} | { type: \"a274\"; a28: number } | { type: \"a275\"; a28: number } | { + type: \"a276\"; a28: number -} | { type: \"a277\", a28: number } | { type: \"a278\", a28: number } | { - type: \"a279\", +} | { type: \"a277\"; a28: number } | { type: \"a278\"; a28: number } | { + type: \"a279\"; a28: number -} | { type: \"a280\", a28: number } | { type: \"a281\", a29: number } | { - type: \"a282\", +} | { type: \"a280\"; a28: number } | { type: \"a281\"; a29: number } | { + type: \"a282\"; a29: number -} | { type: \"a283\", a29: number } | { type: \"a284\", a29: number } | { - type: \"a285\", +} | { type: \"a283\"; a29: number } | { type: \"a284\"; a29: number } | { + type: \"a285\"; a29: number -} | { type: \"a286\", a29: number } | { type: \"a287\", a29: number } | { - type: \"a288\", +} | { type: \"a286\"; a29: number } | { type: \"a287\"; a29: number } | { + type: \"a288\"; a29: number -} | { type: \"a289\", a29: number } | { type: \"a290\", a29: number } | { - type: \"a291\", +} | { type: \"a289\"; a29: number } | { type: \"a290\"; a29: number } | { + type: \"a291\"; a30: number -} | { type: \"a292\", a30: number } | { type: \"a293\", a30: number } | { - type: \"a294\", +} | { type: \"a292\"; a30: number } | { type: \"a293\"; a30: number } | { + type: \"a294\"; a30: number -} | { type: \"a295\", a30: number } | { type: \"a296\", a30: number } | { - type: \"a297\", +} | { type: \"a295\"; a30: number } | { type: \"a296\"; a30: number } | { + type: \"a297\"; a30: number -} | { type: \"a298\", a30: number } | { type: \"a299\", a30: number } | { - type: \"a300\", +} | { type: \"a298\"; a30: number } | { type: \"a299\"; a30: number } | { + type: \"a300\"; a30: number -} | { type: \"a301\", a31: number } | { type: \"a302\", a31: number } | { - type: \"a303\", +} | { type: \"a301\"; a31: number } | { type: \"a302\"; a31: number } | { + type: \"a303\"; a31: number -} | { type: \"a304\", a31: number } | { type: \"a305\", a31: number } | { - type: \"a306\", +} | { type: \"a304\"; a31: number } | { type: \"a305\"; a31: number } | { + type: \"a306\"; a31: number -} | { type: \"a307\", a31: number } | { type: \"a308\", a31: number } | { - type: \"a309\", +} | { type: \"a307\"; a31: number } | { type: \"a308\"; a31: number } | { + type: \"a309\"; a31: number -} | { type: \"a310\", a31: number } | { type: \"a311\", a32: number } | { - type: \"a312\", +} | { type: \"a310\"; a31: number } | { type: \"a311\"; a32: number } | { + type: \"a312\"; a32: number -} | { type: \"a313\", a32: number } | { type: \"a314\", a32: number } | { - type: \"a315\", +} | { type: \"a313\"; a32: number } | { type: \"a314\"; a32: number } | { + type: \"a315\"; a32: number -} | { type: \"a316\", a32: number } | { type: \"a317\", a32: number } | { - type: \"a318\", +} | { type: \"a316\"; a32: number } | { type: \"a317\"; a32: number } | { + type: \"a318\"; a32: number -} | { type: \"a319\", a32: number } | { type: \"a320\", a32: number } | { - type: \"a321\", +} | { type: \"a319\"; a32: number } | { type: \"a320\"; a32: number } | { + type: \"a321\"; a33: number -} | { type: \"a322\", a33: number } | { type: \"a323\", a33: number } | { - type: \"a324\", +} | { type: \"a322\"; a33: number } | { type: \"a323\"; a33: number } | { + type: \"a324\"; a33: number -} | { type: \"a325\", a33: number } | { type: \"a326\", a33: number } | { - type: \"a327\", +} | { type: \"a325\"; a33: number } | { type: \"a326\"; a33: number } | { + type: \"a327\"; a33: number -} | { type: \"a328\", a33: number } | { type: \"a329\", a33: number } | { - type: \"a330\", +} | { type: \"a328\"; a33: number } | { type: \"a329\"; a33: number } | { + type: \"a330\"; a33: number -} | { type: \"a331\", a34: number } | { type: \"a332\", a34: number } | { - type: \"a333\", +} | { type: \"a331\"; a34: number } | { type: \"a332\"; a34: number } | { + type: \"a333\"; a34: number -} | { type: \"a334\", a34: number } | { type: \"a335\", a34: number } | { - type: \"a336\", +} | { type: \"a334\"; a34: number } | { type: \"a335\"; a34: number } | { + type: \"a336\"; a34: number -} | { type: \"a337\", a34: number } | { type: \"a338\", a34: number } | { - type: \"a339\", +} | { type: \"a337\"; a34: number } | { type: \"a338\"; a34: number } | { + type: \"a339\"; a34: number -} | { type: \"a340\", a34: number } | { type: \"a341\", a35: number } | { - type: \"a342\", +} | { type: \"a340\"; a34: number } | { type: \"a341\"; a35: number } | { + type: \"a342\"; a35: number -} | { type: \"a343\", a35: number } | { type: \"a344\", a35: number } | { - type: \"a345\", +} | { type: \"a343\"; a35: number } | { type: \"a344\"; a35: number } | { + type: \"a345\"; a35: number -} | { type: \"a346\", a35: number } | { type: \"a347\", a35: number } | { - type: \"a348\", +} | { type: \"a346\"; a35: number } | { type: \"a347\"; a35: number } | { + type: \"a348\"; a35: number -} | { type: \"a349\", a35: number } | { type: \"a350\", a35: number } | { - type: \"a351\", +} | { type: \"a349\"; a35: number } | { type: \"a350\"; a35: number } | { + type: \"a351\"; a36: number -} | { type: \"a352\", a36: number } | { type: \"a353\", a36: number } | { - type: \"a354\", +} | { type: \"a352\"; a36: number } | { type: \"a353\"; a36: number } | { + type: \"a354\"; a36: number -} | { type: \"a355\", a36: number } | { type: \"a356\", a36: number } | { - type: \"a357\", +} | { type: \"a355\"; a36: number } | { type: \"a356\"; a36: number } | { + type: \"a357\"; a36: number -} | { type: \"a358\", a36: number } | { type: \"a359\", a36: number } | { - type: \"a360\", +} | { type: \"a358\"; a36: number } | { type: \"a359\"; a36: number } | { + type: \"a360\"; a36: number -} | { type: \"a361\", a37: number } | { type: \"a362\", a37: number } | { - type: \"a363\", +} | { type: \"a361\"; a37: number } | { type: \"a362\"; a37: number } | { + type: \"a363\"; a37: number -} | { type: \"a364\", a37: number } | { type: \"a365\", a37: number } | { - type: \"a366\", +} | { type: \"a364\"; a37: number } | { type: \"a365\"; a37: number } | { + type: \"a366\"; a37: number -} | { type: \"a367\", a37: number } | { type: \"a368\", a37: number } | { - type: \"a369\", +} | { type: \"a367\"; a37: number } | { type: \"a368\"; a37: number } | { + type: \"a369\"; a37: number -} | { type: \"a370\", a37: number } | { type: \"a371\", a38: number } | { - type: \"a372\", +} | { type: \"a370\"; a37: number } | { type: \"a371\"; a38: number } | { + type: \"a372\"; a38: number -} | { type: \"a373\", a38: number } | { type: \"a374\", a38: number } | { - type: \"a375\", +} | { type: \"a373\"; a38: number } | { type: \"a374\"; a38: number } | { + type: \"a375\"; a38: number -} | { type: \"a376\", a38: number } | { type: \"a377\", a38: number } | { - type: \"a378\", +} | { type: \"a376\"; a38: number } | { type: \"a377\"; a38: number } | { + type: \"a378\"; a38: number -} | { type: \"a379\", a38: number } | { type: \"a380\", a38: number } | { - type: \"a381\", +} | { type: \"a379\"; a38: number } | { type: \"a380\"; a38: number } | { + type: \"a381\"; a39: number -} | { type: \"a382\", a39: number } | { type: \"a383\", a39: number } | { - type: \"a384\", +} | { type: \"a382\"; a39: number } | { type: \"a383\"; a39: number } | { + type: \"a384\"; a39: number -} | { type: \"a385\", a39: number } | { type: \"a386\", a39: number } | { - type: \"a387\", +} | { type: \"a385\"; a39: number } | { type: \"a386\"; a39: number } | { + type: \"a387\"; a39: number -} | { type: \"a388\", a39: number } | { type: \"a389\", a39: number } | { - type: \"a390\", +} | { type: \"a388\"; a39: number } | { type: \"a389\"; a39: number } | { + type: \"a390\"; a39: number -} | { type: \"a391\", a40: number } | { type: \"a392\", a40: number } | { - type: \"a393\", +} | { type: \"a391\"; a40: number } | { type: \"a392\"; a40: number } | { + type: \"a393\"; a40: number -} | { type: \"a394\", a40: number } | { type: \"a395\", a40: number } | { - type: \"a396\", +} | { type: \"a394\"; a40: number } | { type: \"a395\"; a40: number } | { + type: \"a396\"; a40: number -} | { type: \"a397\", a40: number } | { type: \"a398\", a40: number } | { - type: \"a399\", +} | { type: \"a397\"; a40: number } | { type: \"a398\"; a40: number } | { + type: \"a399\"; a40: number -} | { type: \"a400\", a40: number } | { type: \"a401\", a41: number } | { - type: \"a402\", +} | { type: \"a400\"; a40: number } | { type: \"a401\"; a41: number } | { + type: \"a402\"; a41: number -} | { type: \"a403\", a41: number } | { type: \"a404\", a41: number } | { - type: \"a405\", +} | { type: \"a403\"; a41: number } | { type: \"a404\"; a41: number } | { + type: \"a405\"; a41: number -} | { type: \"a406\", a41: number } | { type: \"a407\", a41: number } | { - type: \"a408\", +} | { type: \"a406\"; a41: number } | { type: \"a407\"; a41: number } | { + type: \"a408\"; a41: number -} | { type: \"a409\", a41: number } | { type: \"a410\", a41: number } | { - type: \"a411\", +} | { type: \"a409\"; a41: number } | { type: \"a410\"; a41: number } | { + type: \"a411\"; a42: number -} | { type: \"a412\", a42: number } | { type: \"a413\", a42: number } | { - type: \"a414\", +} | { type: \"a412\"; a42: number } | { type: \"a413\"; a42: number } | { + type: \"a414\"; a42: number -} | { type: \"a415\", a42: number } | { type: \"a416\", a42: number } | { - type: \"a417\", +} | { type: \"a415\"; a42: number } | { type: \"a416\"; a42: number } | { + type: \"a417\"; a42: number -} | { type: \"a418\", a42: number } | { type: \"a419\", a42: number } | { - type: \"a420\", +} | { type: \"a418\"; a42: number } | { type: \"a419\"; a42: number } | { + type: \"a420\"; a42: number -} | { type: \"a421\", a43: number } | { type: \"a422\", a43: number } | { - type: \"a423\", +} | { type: \"a421\"; a43: number } | { type: \"a422\"; a43: number } | { + type: \"a423\"; a43: number -} | { type: \"a424\", a43: number } | { type: \"a425\", a43: number } | { - type: \"a426\", +} | { type: \"a424\"; a43: number } | { type: \"a425\"; a43: number } | { + type: \"a426\"; a43: number -} | { type: \"a427\", a43: number } | { type: \"a428\", a43: number } | { - type: \"a429\", +} | { type: \"a427\"; a43: number } | { type: \"a428\"; a43: number } | { + type: \"a429\"; a43: number -} | { type: \"a430\", a43: number } | { type: \"a431\", a44: number } | { - type: \"a432\", +} | { type: \"a430\"; a43: number } | { type: \"a431\"; a44: number } | { + type: \"a432\"; a44: number -} | { type: \"a433\", a44: number } | { type: \"a434\", a44: number } | { - type: \"a435\", +} | { type: \"a433\"; a44: number } | { type: \"a434\"; a44: number } | { + type: \"a435\"; a44: number -} | { type: \"a436\", a44: number } | { type: \"a437\", a44: number } | { - type: \"a438\", +} | { type: \"a436\"; a44: number } | { type: \"a437\"; a44: number } | { + type: \"a438\"; a44: number -} | { type: \"a439\", a44: number } | { type: \"a440\", a44: number } | { - type: \"a441\", +} | { type: \"a439\"; a44: number } | { type: \"a440\"; a44: number } | { + type: \"a441\"; a45: number -} | { type: \"a442\", a45: number } | { type: \"a443\", a45: number } | { - type: \"a444\", +} | { type: \"a442\"; a45: number } | { type: \"a443\"; a45: number } | { + type: \"a444\"; a45: number -} | { type: \"a445\", a45: number } | { type: \"a446\", a45: number } | { - type: \"a447\", +} | { type: \"a445\"; a45: number } | { type: \"a446\"; a45: number } | { + type: \"a447\"; a45: number -} | { type: \"a448\", a45: number } | { type: \"a449\", a45: number } | { - type: \"a450\", +} | { type: \"a448\"; a45: number } | { type: \"a449\"; a45: number } | { + type: \"a450\"; a45: number -} | { type: \"a451\", a46: number } | { type: \"a452\", a46: number } | { - type: \"a453\", +} | { type: \"a451\"; a46: number } | { type: \"a452\"; a46: number } | { + type: \"a453\"; a46: number -} | { type: \"a454\", a46: number } | { type: \"a455\", a46: number } | { - type: \"a456\", +} | { type: \"a454\"; a46: number } | { type: \"a455\"; a46: number } | { + type: \"a456\"; a46: number -} | { type: \"a457\", a46: number } | { type: \"a458\", a46: number } | { - type: \"a459\", +} | { type: \"a457\"; a46: number } | { type: \"a458\"; a46: number } | { + type: \"a459\"; a46: number -} | { type: \"a460\", a46: number } | { type: \"a461\", a47: number } | { - type: \"a462\", +} | { type: \"a460\"; a46: number } | { type: \"a461\"; a47: number } | { + type: \"a462\"; a47: number -} | { type: \"a463\", a47: number } | { type: \"a464\", a47: number } | { - type: \"a465\", +} | { type: \"a463\"; a47: number } | { type: \"a464\"; a47: number } | { + type: \"a465\"; a47: number -} | { type: \"a466\", a47: number } | { type: \"a467\", a47: number } | { - type: \"a468\", +} | { type: \"a466\"; a47: number } | { type: \"a467\"; a47: number } | { + type: \"a468\"; a47: number -} | { type: \"a469\", a47: number } | { type: \"a470\", a47: number } | { - type: \"a471\", +} | { type: \"a469\"; a47: number } | { type: \"a470\"; a47: number } | { + type: \"a471\"; a48: number -} | { type: \"a472\", a48: number } | { type: \"a473\", a48: number } | { - type: \"a474\", +} | { type: \"a472\"; a48: number } | { type: \"a473\"; a48: number } | { + type: \"a474\"; a48: number -} | { type: \"a475\", a48: number } | { type: \"a476\", a48: number } | { - type: \"a477\", +} | { type: \"a475\"; a48: number } | { type: \"a476\"; a48: number } | { + type: \"a477\"; a48: number -} | { type: \"a478\", a48: number } | { type: \"a479\", a48: number } | { - type: \"a480\", +} | { type: \"a478\"; a48: number } | { type: \"a479\"; a48: number } | { + type: \"a480\"; a48: number -} | { type: \"a481\", a49: number } | { type: \"a482\", a49: number } | { - type: \"a483\", +} | { type: \"a481\"; a49: number } | { type: \"a482\"; a49: number } | { + type: \"a483\"; a49: number -} | { type: \"a484\", a49: number } | { type: \"a485\", a49: number } | { - type: \"a486\", +} | { type: \"a484\"; a49: number } | { type: \"a485\"; a49: number } | { + type: \"a486\"; a49: number -} | { type: \"a487\", a49: number } | { type: \"a488\", a49: number } | { - type: \"a489\", +} | { type: \"a487\"; a49: number } | { type: \"a488\"; a49: number } | { + type: \"a489\"; a49: number -} | { type: \"a490\", a49: number } | { type: \"a491\", a50: number } | { - type: \"a492\", +} | { type: \"a490\"; a49: number } | { type: \"a491\"; a50: number } | { + type: \"a492\"; a50: number -} | { type: \"a493\", a50: number } | { type: \"a494\", a50: number } | { - type: \"a495\", +} | { type: \"a493\"; a50: number } | { type: \"a494\"; a50: number } | { + type: \"a495\"; a50: number -} | { type: \"a496\", a50: number } | { type: \"a497\", a50: number } | { - type: \"a498\", +} | { type: \"a496\"; a50: number } | { type: \"a497\"; a50: number } | { + type: \"a498\"; a50: number -} | { type: \"a499\", a50: number } | { type: \"a500\", a50: number } | { - type: \"a501\", +} | { type: \"a499\"; a50: number } | { type: \"a500\"; a50: number } | { + type: \"a501\"; a51: number -} | { type: \"a502\", a51: number } | { type: \"a503\", a51: number } | { - type: \"a504\", +} | { type: \"a502\"; a51: number } | { type: \"a503\"; a51: number } | { + type: \"a504\"; a51: number -} | { type: \"a505\", a51: number } | { type: \"a506\", a51: number } | { - type: \"a507\", +} | { type: \"a505\"; a51: number } | { type: \"a506\"; a51: number } | { + type: \"a507\"; a51: number -} | { type: \"a508\", a51: number } | { type: \"a509\", a51: number } | { - type: \"a510\", +} | { type: \"a508\"; a51: number } | { type: \"a509\"; a51: number } | { + type: \"a510\"; a51: number -} | { type: \"a511\", a52: number } | { type: \"a512\", a52: number } | { - type: \"a513\", +} | { type: \"a511\"; a52: number } | { type: \"a512\"; a52: number } | { + type: \"a513\"; a52: number -} | { type: \"a514\", a52: number } | { type: \"a515\", a52: number } | { - type: \"a516\", +} | { type: \"a514\"; a52: number } | { type: \"a515\"; a52: number } | { + type: \"a516\"; a52: number -} | { type: \"a517\", a52: number } | { type: \"a518\", a52: number } | { - type: \"a519\", +} | { type: \"a517\"; a52: number } | { type: \"a518\"; a52: number } | { + type: \"a519\"; a52: number -} | { type: \"a520\", a52: number } | { type: \"a521\", a53: number } | { - type: \"a522\", +} | { type: \"a520\"; a52: number } | { type: \"a521\"; a53: number } | { + type: \"a522\"; a53: number -} | { type: \"a523\", a53: number } | { type: \"a524\", a53: number } | { - type: \"a525\", +} | { type: \"a523\"; a53: number } | { type: \"a524\"; a53: number } | { + type: \"a525\"; a53: number -} | { type: \"a526\", a53: number } | { type: \"a527\", a53: number } | { - type: \"a528\", +} | { type: \"a526\"; a53: number } | { type: \"a527\"; a53: number } | { + type: \"a528\"; a53: number -} | { type: \"a529\", a53: number } | { type: \"a530\", a53: number } | { - type: \"a531\", +} | { type: \"a529\"; a53: number } | { type: \"a530\"; a53: number } | { + type: \"a531\"; a54: number -} | { type: \"a532\", a54: number } | { type: \"a533\", a54: number } | { - type: \"a534\", +} | { type: \"a532\"; a54: number } | { type: \"a533\"; a54: number } | { + type: \"a534\"; a54: number -} | { type: \"a535\", a54: number } | { type: \"a536\", a54: number } | { - type: \"a537\", +} | { type: \"a535\"; a54: number } | { type: \"a536\"; a54: number } | { + type: \"a537\"; a54: number -} | { type: \"a538\", a54: number } | { type: \"a539\", a54: number } | { - type: \"a540\", +} | { type: \"a538\"; a54: number } | { type: \"a539\"; a54: number } | { + type: \"a540\"; a54: number -} | { type: \"a541\", a55: number } | { type: \"a542\", a55: number } | { - type: \"a543\", +} | { type: \"a541\"; a55: number } | { type: \"a542\"; a55: number } | { + type: \"a543\"; a55: number -} | { type: \"a544\", a55: number } | { type: \"a545\", a55: number } | { - type: \"a546\", +} | { type: \"a544\"; a55: number } | { type: \"a545\"; a55: number } | { + type: \"a546\"; a55: number -} | { type: \"a547\", a55: number } | { type: \"a548\", a55: number } | { - type: \"a549\", +} | { type: \"a547\"; a55: number } | { type: \"a548\"; a55: number } | { + type: \"a549\"; a55: number -} | { type: \"a550\", a55: number } | { type: \"a551\", a56: number } | { - type: \"a552\", +} | { type: \"a550\"; a55: number } | { type: \"a551\"; a56: number } | { + type: \"a552\"; a56: number -} | { type: \"a553\", a56: number } | { type: \"a554\", a56: number } | { - type: \"a555\", +} | { type: \"a553\"; a56: number } | { type: \"a554\"; a56: number } | { + type: \"a555\"; a56: number -} | { type: \"a556\", a56: number } | { type: \"a557\", a56: number } | { - type: \"a558\", +} | { type: \"a556\"; a56: number } | { type: \"a557\"; a56: number } | { + type: \"a558\"; a56: number -} | { type: \"a559\", a56: number } | { type: \"a560\", a56: number } | { - type: \"a561\", +} | { type: \"a559\"; a56: number } | { type: \"a560\"; a56: number } | { + type: \"a561\"; a57: number -} | { type: \"a562\", a57: number } | { type: \"a563\", a57: number } | { - type: \"a564\", +} | { type: \"a562\"; a57: number } | { type: \"a563\"; a57: number } | { + type: \"a564\"; a57: number -} | { type: \"a565\", a57: number } | { type: \"a566\", a57: number } | { - type: \"a567\", +} | { type: \"a565\"; a57: number } | { type: \"a566\"; a57: number } | { + type: \"a567\"; a57: number -} | { type: \"a568\", a57: number } | { type: \"a569\", a57: number } | { - type: \"a570\", +} | { type: \"a568\"; a57: number } | { type: \"a569\"; a57: number } | { + type: \"a570\"; a57: number -} | { type: \"a571\", a58: number } | { type: \"a572\", a58: number } | { - type: \"a573\", +} | { type: \"a571\"; a58: number } | { type: \"a572\"; a58: number } | { + type: \"a573\"; a58: number -} | { type: \"a574\", a58: number } | { type: \"a575\", a58: number } | { - type: \"a576\", +} | { type: \"a574\"; a58: number } | { type: \"a575\"; a58: number } | { + type: \"a576\"; a58: number -} | { type: \"a577\", a58: number } | { type: \"a578\", a58: number } | { - type: \"a579\", +} | { type: \"a577\"; a58: number } | { type: \"a578\"; a58: number } | { + type: \"a579\"; a58: number -} | { type: \"a580\", a58: number } | { type: \"a581\", a59: number } | { - type: \"a582\", +} | { type: \"a580\"; a58: number } | { type: \"a581\"; a59: number } | { + type: \"a582\"; a59: number -} | { type: \"a583\", a59: number } | { type: \"a584\", a59: number } | { - type: \"a585\", +} | { type: \"a583\"; a59: number } | { type: \"a584\"; a59: number } | { + type: \"a585\"; a59: number -} | { type: \"a586\", a59: number } | { type: \"a587\", a59: number } | { - type: \"a588\", +} | { type: \"a586\"; a59: number } | { type: \"a587\"; a59: number } | { + type: \"a588\"; a59: number -} | { type: \"a589\", a59: number } | { type: \"a590\", a59: number } | { - type: \"a591\", +} | { type: \"a589\"; a59: number } | { type: \"a590\"; a59: number } | { + type: \"a591\"; a60: number -} | { type: \"a592\", a60: number } | { type: \"a593\", a60: number } | { - type: \"a594\", +} | { type: \"a592\"; a60: number } | { type: \"a593\"; a60: number } | { + type: \"a594\"; a60: number -} | { type: \"a595\", a60: number } | { type: \"a596\", a60: number } | { - type: \"a597\", +} | { type: \"a595\"; a60: number } | { type: \"a596\"; a60: number } | { + type: \"a597\"; a60: number -} | { type: \"a598\", a60: number } | { type: \"a599\", a60: number } | { - type: \"a600\", +} | { type: \"a598\"; a60: number } | { type: \"a599\"; a60: number } | { + type: \"a600\"; a60: number -} | { type: \"a601\", a61: number } | { type: \"a602\", a61: number } | { - type: \"a603\", +} | { type: \"a601\"; a61: number } | { type: \"a602\"; a61: number } | { + type: \"a603\"; a61: number -} | { type: \"a604\", a61: number } | { type: \"a605\", a61: number } | { - type: \"a606\", +} | { type: \"a604\"; a61: number } | { type: \"a605\"; a61: number } | { + type: \"a606\"; a61: number -} | { type: \"a607\", a61: number } | { type: \"a608\", a61: number } | { - type: \"a609\", +} | { type: \"a607\"; a61: number } | { type: \"a608\"; a61: number } | { + type: \"a609\"; a61: number -} | { type: \"a610\", a61: number } | { type: \"a611\", a62: number } | { - type: \"a612\", +} | { type: \"a610\"; a61: number } | { type: \"a611\"; a62: number } | { + type: \"a612\"; a62: number -} | { type: \"a613\", a62: number } | { type: \"a614\", a62: number } | { - type: \"a615\", +} | { type: \"a613\"; a62: number } | { type: \"a614\"; a62: number } | { + type: \"a615\"; a62: number -} | { type: \"a616\", a62: number } | { type: \"a617\", a62: number } | { - type: \"a618\", +} | { type: \"a616\"; a62: number } | { type: \"a617\"; a62: number } | { + type: \"a618\"; a62: number -} | { type: \"a619\", a62: number } | { type: \"a620\", a62: number } | { - type: \"a621\", +} | { type: \"a619\"; a62: number } | { type: \"a620\"; a62: number } | { + type: \"a621\"; a63: number -} | { type: \"a622\", a63: number } | { type: \"a623\", a63: number } | { - type: \"a624\", +} | { type: \"a622\"; a63: number } | { type: \"a623\"; a63: number } | { + type: \"a624\"; a63: number -} | { type: \"a625\", a63: number } | { type: \"a626\", a63: number } | { - type: \"a627\", +} | { type: \"a625\"; a63: number } | { type: \"a626\"; a63: number } | { + type: \"a627\"; a63: number -} | { type: \"a628\", a63: number } | { type: \"a629\", a63: number } | { - type: \"a630\", +} | { type: \"a628\"; a63: number } | { type: \"a629\"; a63: number } | { + type: \"a630\"; a63: number -} | { type: \"a631\", a64: number } | { type: \"a632\", a64: number } | { - type: \"a633\", +} | { type: \"a631\"; a64: number } | { type: \"a632\"; a64: number } | { + type: \"a633\"; a64: number -} | { type: \"a634\", a64: number } | { type: \"a635\", a64: number } | { - type: \"a636\", +} | { type: \"a634\"; a64: number } | { type: \"a635\"; a64: number } | { + type: \"a636\"; a64: number -} | { type: \"a637\", a64: number } | { type: \"a638\", a64: number } | { - type: \"a639\", +} | { type: \"a637\"; a64: number } | { type: \"a638\"; a64: number } | { + type: \"a639\"; a64: number -} | { type: \"a640\", a64: number } | { type: \"a641\", a65: number } | { - type: \"a642\", +} | { type: \"a640\"; a64: number } | { type: \"a641\"; a65: number } | { + type: \"a642\"; a65: number -} | { type: \"a643\", a65: number } | { type: \"a644\", a65: number } | { - type: \"a645\", +} | { type: \"a643\"; a65: number } | { type: \"a644\"; a65: number } | { + type: \"a645\"; a65: number -} | { type: \"a646\", a65: number } | { type: \"a647\", a65: number } | { - type: \"a648\", +} | { type: \"a646\"; a65: number } | { type: \"a647\"; a65: number } | { + type: \"a648\"; a65: number -} | { type: \"a649\", a65: number } | { type: \"a650\", a65: number } | { - type: \"a651\", +} | { type: \"a649\"; a65: number } | { type: \"a650\"; a65: number } | { + type: \"a651\"; a66: number -} | { type: \"a652\", a66: number } | { type: \"a653\", a66: number } | { - type: \"a654\", +} | { type: \"a652\"; a66: number } | { type: \"a653\"; a66: number } | { + type: \"a654\"; a66: number -} | { type: \"a655\", a66: number } | { type: \"a656\", a66: number } | { - type: \"a657\", +} | { type: \"a655\"; a66: number } | { type: \"a656\"; a66: number } | { + type: \"a657\"; a66: number -} | { type: \"a658\", a66: number } | { type: \"a659\", a66: number } | { - type: \"a660\", +} | { type: \"a658\"; a66: number } | { type: \"a659\"; a66: number } | { + type: \"a660\"; a66: number -} | { type: \"a661\", a67: number } | { type: \"a662\", a67: number } | { - type: \"a663\", +} | { type: \"a661\"; a67: number } | { type: \"a662\"; a67: number } | { + type: \"a663\"; a67: number -} | { type: \"a664\", a67: number } | { type: \"a665\", a67: number } | { - type: \"a666\", +} | { type: \"a664\"; a67: number } | { type: \"a665\"; a67: number } | { + type: \"a666\"; a67: number -} | { type: \"a667\", a67: number } | { type: \"a668\", a67: number } | { - type: \"a669\", +} | { type: \"a667\"; a67: number } | { type: \"a668\"; a67: number } | { + type: \"a669\"; a67: number -} | { type: \"a670\", a67: number } | { type: \"a671\", a68: number } | { - type: \"a672\", +} | { type: \"a670\"; a67: number } | { type: \"a671\"; a68: number } | { + type: \"a672\"; a68: number -} | { type: \"a673\", a68: number } | { type: \"a674\", a68: number } | { - type: \"a675\", +} | { type: \"a673\"; a68: number } | { type: \"a674\"; a68: number } | { + type: \"a675\"; a68: number -} | { type: \"a676\", a68: number } | { type: \"a677\", a68: number } | { - type: \"a678\", +} | { type: \"a676\"; a68: number } | { type: \"a677\"; a68: number } | { + type: \"a678\"; a68: number -} | { type: \"a679\", a68: number } | { type: \"a680\", a68: number } | { - type: \"a681\", +} | { type: \"a679\"; a68: number } | { type: \"a680\"; a68: number } | { + type: \"a681\"; a69: number -} | { type: \"a682\", a69: number } | { type: \"a683\", a69: number } | { - type: \"a684\", +} | { type: \"a682\"; a69: number } | { type: \"a683\"; a69: number } | { + type: \"a684\"; a69: number -} | { type: \"a685\", a69: number } | { type: \"a686\", a69: number } | { - type: \"a687\", +} | { type: \"a685\"; a69: number } | { type: \"a686\"; a69: number } | { + type: \"a687\"; a69: number -} | { type: \"a688\", a69: number } | { type: \"a689\", a69: number } | { - type: \"a690\", +} | { type: \"a688\"; a69: number } | { type: \"a689\"; a69: number } | { + type: \"a690\"; a69: number -} | { type: \"a691\", a70: number } | { type: \"a692\", a70: number } | { - type: \"a693\", +} | { type: \"a691\"; a70: number } | { type: \"a692\"; a70: number } | { + type: \"a693\"; a70: number -} | { type: \"a694\", a70: number } | { type: \"a695\", a70: number } | { - type: \"a696\", +} | { type: \"a694\"; a70: number } | { type: \"a695\"; a70: number } | { + type: \"a696\"; a70: number -} | { type: \"a697\", a70: number } | { type: \"a698\", a70: number } | { - type: \"a699\", +} | { type: \"a697\"; a70: number } | { type: \"a698\"; a70: number } | { + type: \"a699\"; a70: number -} | { type: \"a700\", a70: number } | { type: \"a701\", a71: number } | { - type: \"a702\", +} | { type: \"a700\"; a70: number } | { type: \"a701\"; a71: number } | { + type: \"a702\"; a71: number -} | { type: \"a703\", a71: number } | { type: \"a704\", a71: number } | { - type: \"a705\", +} | { type: \"a703\"; a71: number } | { type: \"a704\"; a71: number } | { + type: \"a705\"; a71: number -} | { type: \"a706\", a71: number } | { type: \"a707\", a71: number } | { - type: \"a708\", +} | { type: \"a706\"; a71: number } | { type: \"a707\"; a71: number } | { + type: \"a708\"; a71: number -} | { type: \"a709\", a71: number } | { type: \"a710\", a71: number } | { - type: \"a711\", +} | { type: \"a709\"; a71: number } | { type: \"a710\"; a71: number } | { + type: \"a711\"; a72: number -} | { type: \"a712\", a72: number } | { type: \"a713\", a72: number } | { - type: \"a714\", +} | { type: \"a712\"; a72: number } | { type: \"a713\"; a72: number } | { + type: \"a714\"; a72: number -} | { type: \"a715\", a72: number } | { type: \"a716\", a72: number } | { - type: \"a717\", +} | { type: \"a715\"; a72: number } | { type: \"a716\"; a72: number } | { + type: \"a717\"; a72: number -} | { type: \"a718\", a72: number } | { type: \"a719\", a72: number } | { - type: \"a720\", +} | { type: \"a718\"; a72: number } | { type: \"a719\"; a72: number } | { + type: \"a720\"; a72: number -} | { type: \"a721\", a73: number } | { type: \"a722\", a73: number } | { - type: \"a723\", +} | { type: \"a721\"; a73: number } | { type: \"a722\"; a73: number } | { + type: \"a723\"; a73: number -} | { type: \"a724\", a73: number } | { type: \"a725\", a73: number } | { - type: \"a726\", +} | { type: \"a724\"; a73: number } | { type: \"a725\"; a73: number } | { + type: \"a726\"; a73: number -} | { type: \"a727\", a73: number } | { type: \"a728\", a73: number } | { - type: \"a729\", +} | { type: \"a727\"; a73: number } | { type: \"a728\"; a73: number } | { + type: \"a729\"; a73: number -} | { type: \"a730\", a73: number } | { type: \"a731\", a74: number } | { - type: \"a732\", +} | { type: \"a730\"; a73: number } | { type: \"a731\"; a74: number } | { + type: \"a732\"; a74: number -} | { type: \"a733\", a74: number } | { type: \"a734\", a74: number } | { - type: \"a735\", +} | { type: \"a733\"; a74: number } | { type: \"a734\"; a74: number } | { + type: \"a735\"; a74: number -} | { type: \"a736\", a74: number } | { type: \"a737\", a74: number } | { - type: \"a738\", +} | { type: \"a736\"; a74: number } | { type: \"a737\"; a74: number } | { + type: \"a738\"; a74: number -} | { type: \"a739\", a74: number } | { type: \"a740\", a74: number } | { - type: \"a741\", +} | { type: \"a739\"; a74: number } | { type: \"a740\"; a74: number } | { + type: \"a741\"; a75: number -} | { type: \"a742\", a75: number } | { type: \"a743\", a75: number } | { - type: \"a744\", +} | { type: \"a742\"; a75: number } | { type: \"a743\"; a75: number } | { + type: \"a744\"; a75: number -} | { type: \"a745\", a75: number } | { type: \"a746\", a75: number } | { - type: \"a747\", +} | { type: \"a745\"; a75: number } | { type: \"a746\"; a75: number } | { + type: \"a747\"; a75: number -} | { type: \"a748\", a75: number } | { type: \"a749\", a75: number } | { - type: \"a750\", +} | { type: \"a748\"; a75: number } | { type: \"a749\"; a75: number } | { + type: \"a750\"; a75: number -} | { type: \"a751\", a76: number } | { type: \"a752\", a76: number } | { - type: \"a753\", +} | { type: \"a751\"; a76: number } | { type: \"a752\"; a76: number } | { + type: \"a753\"; a76: number -} | { type: \"a754\", a76: number } | { type: \"a755\", a76: number } | { - type: \"a756\", +} | { type: \"a754\"; a76: number } | { type: \"a755\"; a76: number } | { + type: \"a756\"; a76: number -} | { type: \"a757\", a76: number } | { type: \"a758\", a76: number } | { - type: \"a759\", +} | { type: \"a757\"; a76: number } | { type: \"a758\"; a76: number } | { + type: \"a759\"; a76: number -} | { type: \"a760\", a76: number } | { type: \"a761\", a77: number } | { - type: \"a762\", +} | { type: \"a760\"; a76: number } | { type: \"a761\"; a77: number } | { + type: \"a762\"; a77: number -} | { type: \"a763\", a77: number } | { type: \"a764\", a77: number } | { - type: \"a765\", +} | { type: \"a763\"; a77: number } | { type: \"a764\"; a77: number } | { + type: \"a765\"; a77: number -} | { type: \"a766\", a77: number } | { type: \"a767\", a77: number } | { - type: \"a768\", +} | { type: \"a766\"; a77: number } | { type: \"a767\"; a77: number } | { + type: \"a768\"; a77: number -} | { type: \"a769\", a77: number } | { type: \"a770\", a77: number } | { - type: \"a771\", +} | { type: \"a769\"; a77: number } | { type: \"a770\"; a77: number } | { + type: \"a771\"; a78: number -} | { type: \"a772\", a78: number } | { type: \"a773\", a78: number } | { - type: \"a774\", +} | { type: \"a772\"; a78: number } | { type: \"a773\"; a78: number } | { + type: \"a774\"; a78: number -} | { type: \"a775\", a78: number } | { type: \"a776\", a78: number } | { - type: \"a777\", +} | { type: \"a775\"; a78: number } | { type: \"a776\"; a78: number } | { + type: \"a777\"; a78: number -} | { type: \"a778\", a78: number } | { type: \"a779\", a78: number } | { - type: \"a780\", +} | { type: \"a778\"; a78: number } | { type: \"a779\"; a78: number } | { + type: \"a780\"; a78: number -} | { type: \"a781\", a79: number } | { type: \"a782\", a79: number } | { - type: \"a783\", +} | { type: \"a781\"; a79: number } | { type: \"a782\"; a79: number } | { + type: \"a783\"; a79: number -} | { type: \"a784\", a79: number } | { type: \"a785\", a79: number } | { - type: \"a786\", +} | { type: \"a784\"; a79: number } | { type: \"a785\"; a79: number } | { + type: \"a786\"; a79: number -} | { type: \"a787\", a79: number } | { type: \"a788\", a79: number } | { - type: \"a789\", +} | { type: \"a787\"; a79: number } | { type: \"a788\"; a79: number } | { + type: \"a789\"; a79: number -} | { type: \"a790\", a79: number } | { type: \"a791\", a80: number } | { - type: \"a792\", +} | { type: \"a790\"; a79: number } | { type: \"a791\"; a80: number } | { + type: \"a792\"; a80: number -} | { type: \"a793\", a80: number } | { type: \"a794\", a80: number } | { - type: \"a795\", +} | { type: \"a793\"; a80: number } | { type: \"a794\"; a80: number } | { + type: \"a795\"; a80: number -} | { type: \"a796\", a80: number } | { type: \"a797\", a80: number } | { - type: \"a798\", +} | { type: \"a796\"; a80: number } | { type: \"a797\"; a80: number } | { + type: \"a798\"; a80: number -} | { type: \"a799\", a80: number } | { type: \"a800\", a80: number } | { - type: \"a801\", +} | { type: \"a799\"; a80: number } | { type: \"a800\"; a80: number } | { + type: \"a801\"; a81: number -} | { type: \"a802\", a81: number } | { type: \"a803\", a81: number } | { - type: \"a804\", +} | { type: \"a802\"; a81: number } | { type: \"a803\"; a81: number } | { + type: \"a804\"; a81: number -} | { type: \"a805\", a81: number } | { type: \"a806\", a81: number } | { - type: \"a807\", +} | { type: \"a805\"; a81: number } | { type: \"a806\"; a81: number } | { + type: \"a807\"; a81: number -} | { type: \"a808\", a81: number } | { type: \"a809\", a81: number } | { - type: \"a810\", +} | { type: \"a808\"; a81: number } | { type: \"a809\"; a81: number } | { + type: \"a810\"; a81: number -} | { type: \"a811\", a82: number } | { type: \"a812\", a82: number } | { - type: \"a813\", +} | { type: \"a811\"; a82: number } | { type: \"a812\"; a82: number } | { + type: \"a813\"; a82: number -} | { type: \"a814\", a82: number } | { type: \"a815\", a82: number } | { - type: \"a816\", +} | { type: \"a814\"; a82: number } | { type: \"a815\"; a82: number } | { + type: \"a816\"; a82: number -} | { type: \"a817\", a82: number } | { type: \"a818\", a82: number } | { - type: \"a819\", +} | { type: \"a817\"; a82: number } | { type: \"a818\"; a82: number } | { + type: \"a819\"; a82: number -} | { type: \"a820\", a82: number } | { type: \"a821\", a83: number } | { - type: \"a822\", +} | { type: \"a820\"; a82: number } | { type: \"a821\"; a83: number } | { + type: \"a822\"; a83: number -} | { type: \"a823\", a83: number } | { type: \"a824\", a83: number } | { - type: \"a825\", +} | { type: \"a823\"; a83: number } | { type: \"a824\"; a83: number } | { + type: \"a825\"; a83: number -} | { type: \"a826\", a83: number } | { type: \"a827\", a83: number } | { - type: \"a828\", +} | { type: \"a826\"; a83: number } | { type: \"a827\"; a83: number } | { + type: \"a828\"; a83: number -} | { type: \"a829\", a83: number } | { type: \"a830\", a83: number } | { - type: \"a831\", +} | { type: \"a829\"; a83: number } | { type: \"a830\"; a83: number } | { + type: \"a831\"; a84: number -} | { type: \"a832\", a84: number } | { type: \"a833\", a84: number } | { - type: \"a834\", +} | { type: \"a832\"; a84: number } | { type: \"a833\"; a84: number } | { + type: \"a834\"; a84: number -} | { type: \"a835\", a84: number } | { type: \"a836\", a84: number } | { - type: \"a837\", +} | { type: \"a835\"; a84: number } | { type: \"a836\"; a84: number } | { + type: \"a837\"; a84: number -} | { type: \"a838\", a84: number } | { type: \"a839\", a84: number } | { - type: \"a840\", +} | { type: \"a838\"; a84: number } | { type: \"a839\"; a84: number } | { + type: \"a840\"; a84: number -} | { type: \"a841\", a85: number } | { type: \"a842\", a85: number } | { - type: \"a843\", +} | { type: \"a841\"; a85: number } | { type: \"a842\"; a85: number } | { + type: \"a843\"; a85: number -} | { type: \"a844\", a85: number } | { type: \"a845\", a85: number } | { - type: \"a846\", +} | { type: \"a844\"; a85: number } | { type: \"a845\"; a85: number } | { + type: \"a846\"; a85: number -} | { type: \"a847\", a85: number } | { type: \"a848\", a85: number } | { - type: \"a849\", +} | { type: \"a847\"; a85: number } | { type: \"a848\"; a85: number } | { + type: \"a849\"; a85: number -} | { type: \"a850\", a85: number } | { type: \"a851\", a86: number } | { - type: \"a852\", +} | { type: \"a850\"; a85: number } | { type: \"a851\"; a86: number } | { + type: \"a852\"; a86: number -} | { type: \"a853\", a86: number } | { type: \"a854\", a86: number } | { - type: \"a855\", +} | { type: \"a853\"; a86: number } | { type: \"a854\"; a86: number } | { + type: \"a855\"; a86: number -} | { type: \"a856\", a86: number } | { type: \"a857\", a86: number } | { - type: \"a858\", +} | { type: \"a856\"; a86: number } | { type: \"a857\"; a86: number } | { + type: \"a858\"; a86: number -} | { type: \"a859\", a86: number } | { type: \"a860\", a86: number } | { - type: \"a861\", +} | { type: \"a859\"; a86: number } | { type: \"a860\"; a86: number } | { + type: \"a861\"; a87: number -} | { type: \"a862\", a87: number } | { type: \"a863\", a87: number } | { - type: \"a864\", +} | { type: \"a862\"; a87: number } | { type: \"a863\"; a87: number } | { + type: \"a864\"; a87: number -} | { type: \"a865\", a87: number } | { type: \"a866\", a87: number } | { - type: \"a867\", +} | { type: \"a865\"; a87: number } | { type: \"a866\"; a87: number } | { + type: \"a867\"; a87: number -} | { type: \"a868\", a87: number } | { type: \"a869\", a87: number } | { - type: \"a870\", +} | { type: \"a868\"; a87: number } | { type: \"a869\"; a87: number } | { + type: \"a870\"; a87: number -} | { type: \"a871\", a88: number } | { type: \"a872\", a88: number } | { - type: \"a873\", +} | { type: \"a871\"; a88: number } | { type: \"a872\"; a88: number } | { + type: \"a873\"; a88: number -} | { type: \"a874\", a88: number } | { type: \"a875\", a88: number } | { - type: \"a876\", +} | { type: \"a874\"; a88: number } | { type: \"a875\"; a88: number } | { + type: \"a876\"; a88: number -} | { type: \"a877\", a88: number } | { type: \"a878\", a88: number } | { - type: \"a879\", +} | { type: \"a877\"; a88: number } | { type: \"a878\"; a88: number } | { + type: \"a879\"; a88: number -} | { type: \"a880\", a88: number } | { type: \"a881\", a89: number } | { - type: \"a882\", +} | { type: \"a880\"; a88: number } | { type: \"a881\"; a89: number } | { + type: \"a882\"; a89: number -} | { type: \"a883\", a89: number } | { type: \"a884\", a89: number } | { - type: \"a885\", +} | { type: \"a883\"; a89: number } | { type: \"a884\"; a89: number } | { + type: \"a885\"; a89: number -} | { type: \"a886\", a89: number } | { type: \"a887\", a89: number } | { - type: \"a888\", +} | { type: \"a886\"; a89: number } | { type: \"a887\"; a89: number } | { + type: \"a888\"; a89: number -} | { type: \"a889\", a89: number } | { type: \"a890\", a89: number } | { - type: \"a891\", +} | { type: \"a889\"; a89: number } | { type: \"a890\"; a89: number } | { + type: \"a891\"; a90: number -} | { type: \"a892\", a90: number } | { type: \"a893\", a90: number } | { - type: \"a894\", +} | { type: \"a892\"; a90: number } | { type: \"a893\"; a90: number } | { + type: \"a894\"; a90: number -} | { type: \"a895\", a90: number } | { type: \"a896\", a90: number } | { - type: \"a897\", +} | { type: \"a895\"; a90: number } | { type: \"a896\"; a90: number } | { + type: \"a897\"; a90: number -} | { type: \"a898\", a90: number } | { type: \"a899\", a90: number } | { - type: \"a900\", +} | { type: \"a898\"; a90: number } | { type: \"a899\"; a90: number } | { + type: \"a900\"; a90: number -} | { type: \"a901\", a91: number } | { type: \"a902\", a91: number } | { - type: \"a903\", +} | { type: \"a901\"; a91: number } | { type: \"a902\"; a91: number } | { + type: \"a903\"; a91: number -} | { type: \"a904\", a91: number } | { type: \"a905\", a91: number } | { - type: \"a906\", +} | { type: \"a904\"; a91: number } | { type: \"a905\"; a91: number } | { + type: \"a906\"; a91: number -} | { type: \"a907\", a91: number } | { type: \"a908\", a91: number } | { - type: \"a909\", +} | { type: \"a907\"; a91: number } | { type: \"a908\"; a91: number } | { + type: \"a909\"; a91: number -} | { type: \"a910\", a91: number } | { type: \"a911\", a92: number } | { - type: \"a912\", +} | { type: \"a910\"; a91: number } | { type: \"a911\"; a92: number } | { + type: \"a912\"; a92: number -} | { type: \"a913\", a92: number } | { type: \"a914\", a92: number } | { - type: \"a915\", +} | { type: \"a913\"; a92: number } | { type: \"a914\"; a92: number } | { + type: \"a915\"; a92: number -} | { type: \"a916\", a92: number } | { type: \"a917\", a92: number } | { - type: \"a918\", +} | { type: \"a916\"; a92: number } | { type: \"a917\"; a92: number } | { + type: \"a918\"; a92: number -} | { type: \"a919\", a92: number } | { type: \"a920\", a92: number } | { - type: \"a921\", +} | { type: \"a919\"; a92: number } | { type: \"a920\"; a92: number } | { + type: \"a921\"; a93: number -} | { type: \"a922\", a93: number } | { type: \"a923\", a93: number } | { - type: \"a924\", +} | { type: \"a922\"; a93: number } | { type: \"a923\"; a93: number } | { + type: \"a924\"; a93: number -} | { type: \"a925\", a93: number } | { type: \"a926\", a93: number } | { - type: \"a927\", +} | { type: \"a925\"; a93: number } | { type: \"a926\"; a93: number } | { + type: \"a927\"; a93: number -} | { type: \"a928\", a93: number } | { type: \"a929\", a93: number } | { - type: \"a930\", +} | { type: \"a928\"; a93: number } | { type: \"a929\"; a93: number } | { + type: \"a930\"; a93: number -} | { type: \"a931\", a94: number } | { type: \"a932\", a94: number } | { - type: \"a933\", +} | { type: \"a931\"; a94: number } | { type: \"a932\"; a94: number } | { + type: \"a933\"; a94: number -} | { type: \"a934\", a94: number } | { type: \"a935\", a94: number } | { - type: \"a936\", +} | { type: \"a934\"; a94: number } | { type: \"a935\"; a94: number } | { + type: \"a936\"; a94: number -} | { type: \"a937\", a94: number } | { type: \"a938\", a94: number } | { - type: \"a939\", +} | { type: \"a937\"; a94: number } | { type: \"a938\"; a94: number } | { + type: \"a939\"; a94: number -} | { type: \"a940\", a94: number } | { type: \"a941\", a95: number } | { - type: \"a942\", +} | { type: \"a940\"; a94: number } | { type: \"a941\"; a95: number } | { + type: \"a942\"; a95: number -} | { type: \"a943\", a95: number } | { type: \"a944\", a95: number } | { - type: \"a945\", +} | { type: \"a943\"; a95: number } | { type: \"a944\"; a95: number } | { + type: \"a945\"; a95: number -} | { type: \"a946\", a95: number } | { type: \"a947\", a95: number } | { - type: \"a948\", +} | { type: \"a946\"; a95: number } | { type: \"a947\"; a95: number } | { + type: \"a948\"; a95: number -} | { type: \"a949\", a95: number } | { type: \"a950\", a95: number } | { - type: \"a951\", +} | { type: \"a949\"; a95: number } | { type: \"a950\"; a95: number } | { + type: \"a951\"; a96: number -} | { type: \"a952\", a96: number } | { type: \"a953\", a96: number } | { - type: \"a954\", +} | { type: \"a952\"; a96: number } | { type: \"a953\"; a96: number } | { + type: \"a954\"; a96: number -} | { type: \"a955\", a96: number } | { type: \"a956\", a96: number } | { - type: \"a957\", +} | { type: \"a955\"; a96: number } | { type: \"a956\"; a96: number } | { + type: \"a957\"; a96: number -} | { type: \"a958\", a96: number } | { type: \"a959\", a96: number } | { - type: \"a960\", +} | { type: \"a958\"; a96: number } | { type: \"a959\"; a96: number } | { + type: \"a960\"; a96: number -} | { type: \"a961\", a97: number } | { type: \"a962\", a97: number } | { - type: \"a963\", +} | { type: \"a961\"; a97: number } | { type: \"a962\"; a97: number } | { + type: \"a963\"; a97: number -} | { type: \"a964\", a97: number } | { type: \"a965\", a97: number } | { - type: \"a966\", +} | { type: \"a964\"; a97: number } | { type: \"a965\"; a97: number } | { + type: \"a966\"; a97: number -} | { type: \"a967\", a97: number } | { type: \"a968\", a97: number } | { - type: \"a969\", +} | { type: \"a967\"; a97: number } | { type: \"a968\"; a97: number } | { + type: \"a969\"; a97: number -} | { type: \"a970\", a97: number } | { type: \"a971\", a98: number } | { - type: \"a972\", +} | { type: \"a970\"; a97: number } | { type: \"a971\"; a98: number } | { + type: \"a972\"; a98: number -} | { type: \"a973\", a98: number } | { type: \"a974\", a98: number } | { - type: \"a975\", +} | { type: \"a973\"; a98: number } | { type: \"a974\"; a98: number } | { + type: \"a975\"; a98: number -} | { type: \"a976\", a98: number } | { type: \"a977\", a98: number } | { - type: \"a978\", +} | { type: \"a976\"; a98: number } | { type: \"a977\"; a98: number } | { + type: \"a978\"; a98: number -} | { type: \"a979\", a98: number } | { type: \"a980\", a98: number } | { - type: \"a981\", +} | { type: \"a979\"; a98: number } | { type: \"a980\"; a98: number } | { + type: \"a981\"; a99: number -} | { type: \"a982\", a99: number } | { type: \"a983\", a99: number } | { - type: \"a984\", +} | { type: \"a982\"; a99: number } | { type: \"a983\"; a99: number } | { + type: \"a984\"; a99: number -} | { type: \"a985\", a99: number } | { type: \"a986\", a99: number } | { - type: \"a987\", +} | { type: \"a985\"; a99: number } | { type: \"a986\"; a99: number } | { + type: \"a987\"; a99: number -} | { type: \"a988\", a99: number } | { type: \"a989\", a99: number } | { - type: \"a990\", +} | { type: \"a988\"; a99: number } | { type: \"a989\"; a99: number } | { + type: \"a990\"; a99: number -} | { type: \"a991\", a100: number } | { type: \"a992\", a100: number } | { - type: \"a993\", +} | { type: \"a991\"; a100: number } | { type: \"a992\"; a100: number } | { + type: \"a993\"; a100: number -} | { type: \"a994\", a100: number } | { type: \"a995\", a100: number } | { - type: \"a996\", +} | { type: \"a994\"; a100: number } | { type: \"a995\"; a100: number } | { + type: \"a996\"; a100: number -} | { type: \"a997\", a100: number } | { type: \"a998\", a100: number } | { - type: \"a999\", +} | { type: \"a997\"; a100: number } | { type: \"a998\"; a100: number } | { + type: \"a999\"; a100: number -} | { type: \"a1000\", a100: number }; +} | { type: \"a1000\"; a100: number }; function foo(x: TAction): TAction { return x; } @@ -5030,19 +5030,19 @@ function f4(x: T4): T4 { return x; } type A = { a: number }; type B = { b: number }; type C = { c: number }; -type T1 = A | B & C; +type T1 = (A | B) & C; function f1(x: T1): T1 { return x; } -type T2 = A & B | C; +type T2 = (A & B) | C; function f2(x: T2): T2 { return x; } -type T3 = A & C | B & C; +type T3 = (A & C) | (B & C); function f3(x: T3): T3 { return x; } -type T4 = A | C & B | C; +type T4 = (A | C) & (B | C); function f4(x: T4): T4 { return x; } diff --git a/tests/union/__snapshots__/jsfmt.spec.js.snap b/tests/union/__snapshots__/jsfmt.spec.js.snap index 9490102ab..58a4afe29 100644 --- a/tests/union/__snapshots__/jsfmt.spec.js.snap +++ b/tests/union/__snapshots__/jsfmt.spec.js.snap @@ -56,7 +56,7 @@ var l: Array = [ ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type T = { type: \"a\", a: number } | { type: \"b\", b: string }; +type T = { type: \"a\"; a: number } | { type: \"b\"; b: string }; var l: Array = [ { type: \"a\", a: 1 }, { type: \"a\", a: 2 }, @@ -108,7 +108,7 @@ declare var myclass: Myclass; myclass.myfun([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", function (ar) {}]) myclass.myfun([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", function (ar) {}]) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare class Myclass { myfun: : (myarray: Array) => any } +declare class Myclass { myfun(myarray: Array): any } declare var myclass: Myclass; myclass.myfun( [ @@ -248,7 +248,7 @@ var nested2: FooBarBaz = \'baz\'; */ // inline // through tvars -var nested1: \"foo\" | \"bar\" | \"baz\" = \"baz\"; +var nested1: (\"foo\" | \"bar\") | \"baz\" = \"baz\"; type FooBar = \"foo\" | \"bar\"; type Baz = \"baz\"; type FooBarBaz = FooBar | Baz; @@ -343,7 +343,7 @@ function foo(x: Foo) { } foo(x); foo(y); -type Bar = : () => C | string; +type Bar = () => C | string; function f() { return \"\"; } @@ -439,7 +439,7 @@ function CD(b) { } qux2(new C()); } -declare class F { foo: : (x: number) => void, foo: : (x: string) => void } +declare class F { foo(x: number): void; foo(x: string): void } function corge(b) { var x = (b ? \"\" : 0); new F().foo(x); diff --git a/tests/union_new/__snapshots__/jsfmt.spec.js.snap b/tests/union_new/__snapshots__/jsfmt.spec.js.snap index b61c50f78..806ecbe03 100644 --- a/tests/union_new/__snapshots__/jsfmt.spec.js.snap +++ b/tests/union_new/__snapshots__/jsfmt.spec.js.snap @@ -61,7 +61,7 @@ export default class A { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ import { B, C } from \"./issue-824-helper\"; type K = B | C; -type I = { which: : () => number }; +type I = { which(): number }; export default class A { static foo(p: K): boolean { return false; @@ -110,7 +110,7 @@ var bar: Array<{b: ?boolean, c: number} | {b: boolean}> = [ ]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -var bar: Array<{ b: ?boolean, c: number } | { b: boolean }> = [ +var bar: Array<{ b: ?boolean; c: number } | { b: boolean }> = [ { b: true, c: 123 }, { b: true } ]; @@ -126,8 +126,8 @@ exports[`test issue-1371.js 1`] = ` } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function create(a: any): { type: \"B\", data: number } | { - type: \"A\", +function create(a: any): { type: \"B\"; data: number } | { + type: \"A\"; data: string } { return { type: \"A\", data: a }; @@ -193,8 +193,8 @@ function printAll(val: MyType) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // <--- foo could be an array type Common = {}; -type A = Common & { type: \"A\", foo: number }; -type B = Common & { type: \"B\", foo: Array }; +type A = Common & { type: \"A\"; foo: number }; +type B = Common & { type: \"B\"; foo: Array }; type MyType = A | B; function print(x: number) { console.log(x); @@ -235,8 +235,8 @@ function printAll(val: MyType) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ type Common = {}; -type A = { type: \"A\", foo: number } & Common; -type B = { type: \"B\", foo: Array } & Common; +type A = { type: \"A\"; foo: number } & Common; +type B = { type: \"B\"; foo: Array } & Common; type MyType = A | B; function print(x: number) { console.log(x); @@ -280,7 +280,7 @@ if (data.kind === \"system\") { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type DataBase = { id: string, name: string }; +type DataBase = { id: string; name: string }; type UserData = DataBase & { kind: \"user\" }; type SystemData = DataBase & { kind: \"system\" }; type Data = UserData | SystemData; @@ -303,7 +303,7 @@ function hello(x:X): string { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @flow //type X = {a:true, b:string} | {a:false, c:string}; // this works. -type X = { a: true } & { b: string } | { a: false } & { c: string }; +type X = ({ a: true } & { b: string }) | ({ a: false } & { c: string }); function hello(x: X): string { if (x.a === true) return x.b; @@ -340,10 +340,10 @@ function test(f: Foo| EmptyFoo) { } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -type Entity = { id: T, name: string }; +type Entity = { id: T; name: string }; type StringEntity = Entity; -type Foo = StringEntity & { bars: Object, kind: 1 }; -type EmptyFoo = StringEntity & { bars: null, kind: 2 }; +type Foo = StringEntity & { bars: Object; kind: 1 }; +type EmptyFoo = StringEntity & { bars: null; kind: 2 }; function test(f: Foo | EmptyFoo) { if (f.kind === 1) { (f: Foo); @@ -446,8 +446,8 @@ function fun(a: A3 | A4) { return a(); } const fun_result = fun(() => \"\"); -type A3 = : () => B3; -type A4 = : () => B4; +type A3 = () => B3; +type A4 = () => B4; type B3 = number; type B4 = string; (fun_result: B3 | B4); @@ -565,11 +565,11 @@ function obj(a: { x: number } | { x: string }) { obj(({ x: \"\" }: A1)); type A1 = { x: B1 }; type B1 = string; -function fun(a: : () => number | : () => string) { +function fun(a: (() => number) | (() => string)) { } fun((() => \"\": A2)); -type A2 = : () => B2; +type A2 = () => B2; type B2 = string; class C {} function inst(a: C | C) { @@ -587,7 +587,7 @@ alias({ } }); type T = { x: U }; -type U = : (x: V) => void; +type U = (x: V) => void; type V = X; type B4 = string; function stat(a: { x: number } | { x: string }) { @@ -598,11 +598,11 @@ class D { } stat(D); type B5 = string; -function tup(a: [numberboolean] | [stringboolean]) { +function tup(a: [number, boolean] | [string, boolean]) { } tup(([ \"\", false ]: A6)); -type A6 = [B6boolean]; +type A6 = [B6, boolean]; type B6 = string; " `; @@ -648,7 +648,7 @@ type B2 = string; //////////////////////////// // example with array types //////////////////////////// -function fun(a: : (x: number) => void | : (x: string) => void) { +function fun(a: ((x: number) => void) | ((x: string) => void)) { } fun( @@ -656,7 +656,7 @@ fun( }: A1) ); -type A1 = : (x: B1) => void; +type A1 = (x: B1) => void; type B1 = string; function arr(a: number[] | string[]) { @@ -715,7 +715,7 @@ type B2 = string; //////////////////////////// // example with array types //////////////////////////// -function fun(a: : (x: number) => void | : (x: string) => void) { +function fun(a: ((x: number) => void) | ((x: string) => void)) { } const a1 = (x => { @@ -725,7 +725,7 @@ fun(a1); function fun_call(x: string) { a1(x); } -type A1 = : (x: B1) => void; +type A1 = (x: B1) => void; type B1 = string; function arr(a: number[] | string[]) { @@ -782,7 +782,7 @@ function arr_set(x: string, i: number) { a2[i] = x; } ///////////////////////////// // example with array types ///////////////////////////// -function fun(a: : (x: number) => number | : (x: string) => string) { +function fun(a: ((x: number) => number) | ((x: string) => string)) { } function a1(x) { @@ -899,8 +899,8 @@ function rec(x: F1 | F2) { rec({ x: 0 }); type F1 = G1; type F2 = G2; -type G1 = { x: H1, y?: G1 }; -type G2 = { x: H2, y?: G2 }; +type G1 = { x: H1; y?: G1 }; +type G2 = { x: H2; y?: G2 }; type H1 = string; type H2 = number; function polyrec(x: PF | PF) { @@ -908,7 +908,7 @@ function polyrec(x: PF | PF) { } rec({ x: 0 }); type PF = PG; -type PG = { x: X, y?: PG }; +type PG = { x: X; y?: PG }; " `; @@ -986,10 +986,10 @@ foo((x): number => square(x)) //////////////// // interference //////////////// -function square(x = 0) { +function square(x? = 0) { return x * x; } -function foo(f: : (_: ?number) => ?number | : () => void) { +function foo(f: ((_: ?number) => ?number) | (() => void)) { } foo((x): number => square(x)); @@ -1114,7 +1114,7 @@ function check_inst(_: C | D) { } check_inst(new D()); check_inst(id(new C())); -function check_fun(_: : (_: number) => number | : (_: string) => string) { +function check_fun(_: ((_: number) => number) | ((_: string) => string)) { } check_fun(x => x); @@ -1172,7 +1172,7 @@ length({ kind: \"cons\", next: { kind: \"nil\" } }); length({ kind: \"empty\" }); type List = Nil | Cons; type Nil = { kind: \"nil\" }; -type Cons = { kind: \"cons\", next: List }; +type Cons = { kind: \"cons\"; next: List }; " `; @@ -1189,7 +1189,7 @@ function rec(x: F): G | H { return x; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow // polymorphic recursive types -type F = { f: F, x: X }; +type F = { f: F; x: X }; type G = { x: number }; type H = { x: string }; function rec(x: F): G | H { @@ -1213,8 +1213,8 @@ exports[`test test13.js 1`] = ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow /* ensure there are no unintended side effects when trying branches */ -({ type: \"B\", id: \"hi\" }: { type: \"A\", id: ?string } | { - type: \"B\", +({ type: \"B\", id: \"hi\" }: { type: \"A\"; id: ?string } | { + type: \"B\"; id: string }); " @@ -1237,7 +1237,7 @@ function foo(c: C) { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow // annotations -declare class C { get: : () => X } +declare class C { get(): X } function union(o: { x: string } | { x: number }) { } @@ -1285,14 +1285,14 @@ function foo(target: EventTarget) { ); } declare class EventTarget { - addEventListener: : (type: \"foo\", listener: KeyboardEventHandler) => void, - addEventListener: : (type: string, listener: EventHandler) => void + addEventListener(type: \"foo\", listener: KeyboardEventHandler): void; + addEventListener(type: string, listener: EventHandler): void } declare class Event {} declare class KeyboardEvent {} -type EventHandler = : (event: Event) => mixed; -type KeyboardEventHandler = : (event: KeyboardEvent) => mixed; -function bar(x: : () => void | { x: number }) { +type EventHandler = (event: Event) => mixed; +type KeyboardEventHandler = (event: KeyboardEvent) => mixed; +function bar(x: (() => void) | { x: number }) { } bar( @@ -1325,9 +1325,9 @@ x = \"\"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow // annotations -type T = number | : () => string; -type Foo = T | : () => boolean; -type Bar = number | : () => string | : () => boolean; +type T = number | (() => string); +type Foo = T | (() => boolean); +type Bar = number | (() => string) | (() => boolean); function foo(x: Foo) { } @@ -1376,7 +1376,7 @@ new C().m(f()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow // method overloads -declare class C { m: : (x: number) => void, m: : (x: string) => void } +declare class C { m(x: number): void; m(x: string): void } function f() { return 0; } @@ -1403,10 +1403,7 @@ declare class D { function m() { return new D(); } -declare class D { - constructor: : (_: void) => void, - constructor: : (_: null) => void -} +declare class D { constructor(_: void): void; constructor(_: null): void } " `; @@ -1464,7 +1461,7 @@ function str() { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow // annotations for disjoint unions -type T = { type: \"FOO\", x: number } | { type: \"BAR\", x: string }; +type T = { type: \"FOO\"; x: number } | { type: \"BAR\"; x: string }; ({ type: (bar(): \"BAR\"), x: str() }: T); ({ type: bar(), x: str() }: T); ({ type: bar(), x: (str(): string) }: T); @@ -1503,7 +1500,7 @@ function foo(x: T) { // @noflow // refinement of disjoint unions type Empty = {}; -type Success = { type: \"SUCCESS\", result: string }; +type Success = { type: \"SUCCESS\"; result: string }; type Error = { type: \"ERROR\" } & Empty; export type T = Success | Error; function foo(x: T) { @@ -1577,27 +1574,30 @@ declare class D extends C { // @noflow // scaling test for full type resolution declare class C { - addListener: : (event: string, listener: Function) => C, - emit: : (event: string) => boolean, - listeners: : (event: string) => Array, - listenerCount: : (event: string) => number, - on: : (event: string, listener: Function) => C, - once: : (event: string, listener: Function) => C, - removeAllListeners: : (event?: string) => C, - removeListener: : (event: string, listener: Function) => C, - setMaxListeners: : (n: number) => void + addListener(event: string, listener: Function): C; + emit(event: string, ...args: Array): boolean; + listeners(event: string): Array; + listenerCount(event: string): number; + on(event: string, listener: Function): C; + once(event: string, listener: Function): C; + removeAllListeners(event?: string): C; + removeListener(event: string, listener: Function): C; + setMaxListeners(n: number): void } -declare class D { - listen: : (port: number, hostname?: string, backlog?: number, callback?: Function) => D, - listen: : (path: string, callback?: Function) => D, - listen: : (handle: Object, callback?: Function) => D, - close: : (callback?: Function) => D, - address: : () => number, - connections: number, - maxConnections: number, - getConnections: : (callback: Function) => void, - ref: : () => D, - unref: : () => D +declare class D extends C { + listen(port: number, + hostname?: string, + backlog?: number, + callback?: Function): D; + listen(path: string, callback?: Function): D; + listen(handle: Object, callback?: Function): D; + close(callback?: Function): D; + address(): number; + connections: number; + maxConnections: number; + getConnections(callback: Function): void; + ref(): D; + unref(): D } (0: D | number); " @@ -1660,8 +1660,8 @@ type T = number | string; declare var y: T; (foo(y): T); declare class Record { - set: : (x: \"foo\", y: number) => void, - set: : (x: \"bar\", y: string) => void + set(x: \"foo\", y: number): void; + set(x: \"bar\", y: string): void } new Record().set(\"foo\", \"42\"); " @@ -1691,7 +1691,7 @@ function hello4(x:X): string { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow //type X = {a:true, b:string} | {a:false, c:string}; // this works. -type X = { a: true } & { b: string } | { a: false } & { c: string }; +type X = ({ a: true } & { b: string }) | ({ a: false } & { c: string }); function hello1(x: X): string { if (x.a === true) return x.b; @@ -1760,9 +1760,11 @@ class C { // polymorphic definitions, where the same code may be checked multiple times // with different instantiations. type Row = { x: string }; -declare class D { - reduce: : (callbackfn: (previousValue: T, currentValue: T) => T, initialValue: void) => T, - reduce: : (callbackfn: (previousValue: U, currentValue: T) => U, initialValue: U) => U +declare class D { + reduce(callbackfn: (previousValue: T, currentValue: T) => T, + initialValue: void): T; + reduce(callbackfn: (previousValue: U, currentValue: T) => U, + initialValue: U): U } class C { foo(rows: D, minWidth: number): number { @@ -1785,7 +1787,7 @@ type ActionType = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // @noflow const Constants = require(\"./test30-helper\"); -type ActionType = { type: \"foo\", x: number } | { type: \"bar\", x: number }; +type ActionType = { type: \"foo\"; x: number } | { type: \"bar\"; x: number }; ({ type: Constants.BAR, x: 0 }: ActionType); " `; @@ -1833,14 +1835,14 @@ function foo(): ImmutableMap { // @noflow // make sure tuples are type arguments (as used e.g. when viewing maps as // key/value iterables) work -interface SomeIterator extends {} -interface SomeIterable extends { it: : () => SomeIterator } -declare class SomeMap { - it: : () => SomeIterator<[KV]>, - set: : (k: K, v: V) => void +interface SomeIterator {} +interface SomeIterable { it(): SomeIterator } +declare class SomeMap { + it(): SomeIterator<[K, V]>; + set(k: K, v: V): void } -declare class ImmutableMap {} -declare function convert(iter: SomeIterable<[KV]>): ImmutableMap; +declare class ImmutableMap {} +declare function convert(iter: SomeIterable<[K, V]>): ImmutableMap; function foo(): ImmutableMap { const countersGlobalMap = new SomeMap(); countersGlobalMap.set(\"\", false); diff --git a/tests/union_new/lib/__snapshots__/jsfmt.spec.js.snap b/tests/union_new/lib/__snapshots__/jsfmt.spec.js.snap index 6562e93a5..bd8363a17 100644 --- a/tests/union_new/lib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/union_new/lib/__snapshots__/jsfmt.spec.js.snap @@ -28,13 +28,17 @@ declare class Rows { ): X; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -declare class Set { add: : () => Set } +declare class Set { add(): Set } declare class Row { - reduce_row: : (callbackfn: (previousValue: number, currentValue: number) => number, initialValue: void) => number, - reduce_row: : (callbackfn: (previousValue: U, currentValue: number) => U, initialValue: U) => U + reduce_row(callbackfn: (previousValue: number, + currentValue: number) => number, + initialValue: void): number; + reduce_row(callbackfn: (previousValue: U, currentValue: number) => U, + initialValue: U): U } declare class Rows { - reduce_rows: : (callbackfn: (previousValue: X, currentValue: Row) => X, initialValue: X) => X + reduce_rows(callbackfn: (previousValue: X, currentValue: Row) => X, + initialValue: X): X } " `; diff --git a/tests/unreachable/__snapshots__/jsfmt.spec.js.snap b/tests/unreachable/__snapshots__/jsfmt.spec.js.snap index 73e3ab83f..05f9bad37 100644 --- a/tests/unreachable/__snapshots__/jsfmt.spec.js.snap +++ b/tests/unreachable/__snapshots__/jsfmt.spec.js.snap @@ -49,7 +49,7 @@ exports[`test unreachable.js 1`] = ` "/* @flow */ function foo(x, y) { - \"use strict\"; + "use strict"; return bar(x) + baz(y); // function declaration is hoisted, should not generate warning @@ -80,7 +80,7 @@ foo(1, 2); // variable declaration is hoisted, should not generate warning // assignments are not hoisted, should generate 2 warnings function foo(x, y) { - \"use strict\"; + "use strict"; return bar(x) + baz(y); function bar(ecks) { return x + ecks; diff --git a/tests/value/__snapshots__/jsfmt.spec.js.snap b/tests/value/__snapshots__/jsfmt.spec.js.snap index cb0d055f8..cd1ee30dc 100644 --- a/tests/value/__snapshots__/jsfmt.spec.js.snap +++ b/tests/value/__snapshots__/jsfmt.spec.js.snap @@ -1,15 +1,15 @@ exports[`test value.js 1`] = ` "var o = {}; -o[\"x\"] = 4; -var y:string = o[\"x\"]; +o["x"] = 4; +var y:string = o["x"]; var table: { [_: string]: number } = {}; -table[\"x\"] = \"hello\"; +table["x"] = "hello"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ var o = {}; -o[\"x\"] = 4; -var y: string = o[\"x\"]; +o["x"] = 4; +var y: string = o["x"]; var table: { [_: string]: number } = {}; -table[\"x\"] = \"hello\"; +table["x"] = "hello"; " `; diff --git a/tests/weakmode/__snapshots__/jsfmt.spec.js.snap b/tests/weakmode/__snapshots__/jsfmt.spec.js.snap index 3b30766d9..e74a014cd 100644 --- a/tests/weakmode/__snapshots__/jsfmt.spec.js.snap +++ b/tests/weakmode/__snapshots__/jsfmt.spec.js.snap @@ -3,7 +3,7 @@ exports[`test should_fail_without_weak.js 1`] = ` // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return \"Hello\"; + return "Hello"; } function expects_an_int() { @@ -13,7 +13,7 @@ function expects_an_int() { /* @flow */ // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return \"Hello\"; + return "Hello"; } function expects_an_int() { return returns_a_string() * 10; @@ -26,7 +26,7 @@ exports[`test should_pass_with_weak.js 1`] = ` // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return \"Hello\"; + return "Hello"; } function expects_an_int() { @@ -36,7 +36,7 @@ function expects_an_int() { /* @flow weak */ // This should fail without weak mode, because of the glaring type error. function returns_a_string() { - return \"Hello\"; + return "Hello"; } function expects_an_int() { return returns_a_string() * 10; diff --git a/tests/while/__snapshots__/jsfmt.spec.js.snap b/tests/while/__snapshots__/jsfmt.spec.js.snap index 43e3bb655..1ddf70d9a 100644 --- a/tests/while/__snapshots__/jsfmt.spec.js.snap +++ b/tests/while/__snapshots__/jsfmt.spec.js.snap @@ -9,7 +9,7 @@ function foo(x: boolean) { } return; } - //console.log(\'this is still reachable\'); + //console.log('this is still reachable'); } function bar(x: boolean) { @@ -17,12 +17,12 @@ function bar(x: boolean) { while (ii > 0) { return; } - //console.log(\'this is still reachable\'); + //console.log('this is still reachable'); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ -//console.log(\'this is still reachable\'); -//console.log(\'this is still reachable\'); +//console.log('this is still reachable'); +//console.log('this is still reachable'); function foo(x: boolean) { var ii = 10; while (ii-- >= 0) { diff --git a/tests/yield/__snapshots__/jsfmt.spec.js.snap b/tests/yield/__snapshots__/jsfmt.spec.js.snap deleted file mode 100644 index 33e3d14ad..000000000 --- a/tests/yield/__snapshots__/jsfmt.spec.js.snap +++ /dev/null @@ -1,25 +0,0 @@ -exports[`test yield_arrow_error.js 1`] = ` -"function * f () { - var e = () => { yield 1; }; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function* f() { - var e = () => { - yield; - 1; - }; -} -" -`; - -exports[`test yield_arrow_error2.js 1`] = ` -"function * f () { - var e = () => yield 1; -} -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function* f() { - var e = () => yield; - 1; -} -" -`; diff --git a/tests/yield/jsfmt.spec.js b/tests/yield/jsfmt.spec.js deleted file mode 100644 index 989047bcc..000000000 --- a/tests/yield/jsfmt.spec.js +++ /dev/null @@ -1 +0,0 @@ -run_spec(__dirname); diff --git a/tests/yield/yield_arrow_error.js b/tests/yield/yield_arrow_error.js deleted file mode 100644 index 330a07e8a..000000000 --- a/tests/yield/yield_arrow_error.js +++ /dev/null @@ -1,3 +0,0 @@ -function * f () { - var e = () => { yield 1; }; -} diff --git a/tests/yield/yield_arrow_error2.js b/tests/yield/yield_arrow_error2.js deleted file mode 100644 index 243ac23ee..000000000 --- a/tests/yield/yield_arrow_error2.js +++ /dev/null @@ -1,3 +0,0 @@ -function * f () { - var e = () => yield 1; -} diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js index 2c98c99a3..3968a14a1 100644 --- a/tests_config/run_spec.js +++ b/tests_config/run_spec.js @@ -2,13 +2,13 @@ const fs = require('fs'); const child_process = require('child_process'); const jscodefmt = require("../"); +const RUN_AST_TESTS = process.env["AST_COMPARE"]; + function run_spec(dirname) { fs.readdirSync(dirname).forEach(filename => { if (filename.endsWith('.js') && filename !== 'jsfmt.spec.js') { const path = dirname + '/' + filename; - const RUN_AST_TESTS = false; - if (!RUN_AST_TESTS) { const source = read(path); const output = prettyprint(source); @@ -33,7 +33,11 @@ function run_spec(dirname) { test(path + ' parse', () => { expect(pperr).toBe(null); expect(ppast).toBeDefined(); - // expect(ast).toEqual(ppast); + if(RUN_AST_TESTS === "1") { + if(ast.errors.length === 0) { + expect(ast).toEqual(ppast); + } + } }); }