├── src ├── typing │ └── deps_js.ml ├── parser │ ├── tools │ │ └── .gitignore │ ├── .gitignore │ ├── .npmignore │ └── test │ │ └── run_all.sh ├── dts │ └── tests │ │ ├── numbered_keys │ │ ├── .flowconfig │ │ ├── numbered_keys.js │ │ ├── declarations │ │ │ ├── numbered_keys.d.ts │ │ │ └── numbered_keys.js.exp │ │ └── numbered_keys.exp │ │ ├── union │ │ ├── declarations │ │ │ ├── union.d.ts │ │ │ └── union.js.exp │ │ ├── union.js │ │ ├── .flowconfig │ │ └── union.exp │ │ ├── enums │ │ ├── declarations │ │ │ ├── enums.d.ts │ │ │ └── enums.js.exp │ │ ├── .flowconfig │ │ ├── enums.exp │ │ └── enums.js │ │ ├── functions │ │ ├── functions.js │ │ ├── .flowconfig │ │ └── declarations │ │ │ ├── functions.d.ts │ │ │ └── functions.js.exp │ │ ├── .gitignore │ │ ├── classes │ │ ├── .flowconfig │ │ ├── classes.js │ │ ├── classes.exp │ │ └── declarations │ │ │ ├── classes.js.exp │ │ │ └── classes.d.ts │ │ ├── modules │ │ ├── .flowconfig │ │ ├── modules.js │ │ └── declarations │ │ │ ├── modules.d.ts │ │ │ └── modules.js.exp │ │ ├── modules2 │ │ ├── .flowconfig │ │ ├── modules2.js │ │ ├── declarations │ │ │ ├── modules2.d.ts │ │ │ └── modules2.js.exp │ │ └── modules2.exp │ │ ├── type_alias │ │ ├── .flowconfig │ │ ├── type_alias.js │ │ └── declarations │ │ │ ├── type_alias.d.ts │ │ │ └── type_alias.js.exp │ │ ├── export_modules │ │ ├── .flowconfig │ │ ├── export_modules.js │ │ └── export_modules.exp │ │ ├── import_commonjs │ │ ├── .flowconfig │ │ └── import_commonjs.js │ │ ├── interface_var │ │ ├── .flowconfig │ │ ├── interface_var.js │ │ ├── declarations │ │ │ ├── interface_var.js.exp │ │ │ └── interface_var.d.ts │ │ └── interface_var.exp │ │ ├── nested_modules │ │ └── .flowconfig │ │ └── var_interface │ │ ├── .flowconfig │ │ ├── var_interface.js │ │ ├── declarations │ │ ├── var_interface.js.exp │ │ └── var_interface.d.ts │ │ └── var_interface.exp ├── stubs │ └── haste_module_preprocessor.mli └── common │ ├── span.mli │ └── FlowJSON.mli ├── tests ├── react │ ├── .flowconfig │ ├── import_react.js │ ├── proptype_oneOf.js │ └── jsx_spread.js ├── rec │ └── .flowconfig ├── shape │ ├── .flowconfig │ ├── shape.exp │ └── test.js ├── taint │ ├── .flowconfig │ ├── taint2.js │ ├── taint1.js │ ├── taint4.js │ ├── taint3.js │ └── globals.js ├── throw │ ├── .flowconfig │ └── throw.exp ├── try │ └── .flowconfig ├── unary │ └── .flowconfig ├── while │ ├── .flowconfig │ ├── while.exp │ └── test.js ├── .gitignore ├── auxiliary │ ├── .flowconfig │ ├── client.js │ ├── lib │ │ └── lib.js │ └── real_node_modules │ │ └── symlink_lib_outside_root │ │ ├── index.js │ │ └── package.json ├── binding │ └── .flowconfig ├── class_type │ ├── .flowconfig │ ├── class_type.exp │ └── test.js ├── covariance │ ├── .flowconfig │ └── covariance.exp ├── deps │ ├── F.js │ ├── H.js │ ├── A.js │ ├── B.js │ ├── D.js │ ├── E.js │ ├── G.js │ ├── I.js │ ├── deps.exp │ ├── .flowconfig │ └── C.js ├── dictionary │ ├── .flowconfig │ ├── test_client.js │ └── test.js ├── dump-types │ ├── .flowconfig │ ├── .testconfig │ ├── import.js │ ├── test.js │ └── test.sh ├── extensions │ ├── .flowconfig │ ├── bar.jsx │ ├── foo.js │ └── extensions.exp ├── issues-11 │ ├── .flowconfig │ ├── export.js │ ├── import.js │ └── issues-11.exp ├── mixins │ ├── .flowconfig │ ├── Bar.js │ ├── test.js │ └── mixins.exp ├── node_haste │ ├── ws │ │ ├── index.js │ │ └── test │ │ │ └── client.js │ ├── external │ │ └── _d3 │ │ │ ├── min.js │ │ │ └── package.json │ ├── md5.js │ ├── node_modules │ │ └── qux │ │ │ ├── corge │ │ │ ├── lib │ │ │ │ └── index.js │ │ │ └── package.json │ │ │ └── docblock.js │ ├── client.js │ ├── .flowconfig │ ├── node_haste.exp │ └── foo │ │ └── bar │ │ └── client.js ├── node_tests │ ├── .flowconfig │ ├── jsx │ │ ├── .flowconfig │ │ ├── bar.jsx │ │ └── foo.jsx │ ├── basic │ │ ├── .flowconfig │ │ ├── bar.js │ │ └── foo.js │ ├── jsx_file │ │ ├── .flowconfig │ │ ├── bar.jsx │ │ └── foo.jsx │ ├── stream │ │ └── .flowconfig │ ├── basic_file │ │ ├── .flowconfig │ │ ├── bar.js │ │ └── foo.js │ ├── basic_package │ │ ├── .flowconfig │ │ ├── bar_lib │ │ │ ├── bar.js │ │ │ └── package.json │ │ └── foo.js │ ├── child_process │ │ └── .flowconfig │ ├── package_file │ │ ├── .flowconfig │ │ ├── bar_lib │ │ │ ├── bar.js │ │ │ └── package.json │ │ ├── bar_lib.js │ │ └── foo.js │ ├── path_package │ │ ├── .flowconfig │ │ ├── node_modules │ │ │ └── bar_lib │ │ │ │ └── src │ │ │ │ └── lib │ │ │ │ ├── bar.js │ │ │ │ └── package.json │ │ └── foo.js │ ├── basic_node_modules │ │ ├── .flowconfig │ │ ├── node_modules │ │ │ └── bar.js │ │ └── foo.js │ ├── path_node_modules │ │ ├── .flowconfig │ │ ├── node_modules │ │ │ └── bar_lib │ │ │ │ └── src │ │ │ │ └── lib │ │ │ │ └── bar.js │ │ └── foo.js │ ├── invalid_package_file │ │ ├── .flowconfig │ │ └── package.json │ ├── package_file_node_modules │ │ ├── .flowconfig │ │ ├── node_modules │ │ │ └── bar_lib.js │ │ └── foo │ │ │ ├── node_modules │ │ │ └── bar_lib │ │ │ │ ├── bar.js │ │ │ │ └── package.json │ │ │ └── foo.js │ ├── basic_node_modules_with_path │ │ ├── node_modules │ │ │ └── bar_lib │ │ │ │ └── bar.js │ │ └── foo.js │ ├── path_node_modules_with_short_main │ │ ├── node_modules │ │ │ └── bar_lib │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ └── foo.js │ ├── path_node_modules_with_symlinks │ │ ├── node_modules │ │ │ ├── symlink_lib │ │ │ └── symlink_lib_outside_root │ │ ├── real_node_modules │ │ │ └── symlink_lib │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ └── foo.js │ ├── path_node_modules_without_main │ │ ├── foo.js │ │ └── node_modules │ │ │ └── bar_lib │ │ │ ├── index.js │ │ │ └── package.json │ ├── node_tests.exp │ └── assert │ │ └── assert.js ├── parse │ ├── fail.js │ ├── fail-flow.js │ ├── fail-flow-2.js │ ├── .flowconfig │ ├── no_parse_error.js │ └── parse.exp ├── record │ └── .flowconfig ├── return_new │ ├── .flowconfig │ └── test2.js ├── singleton │ ├── .flowconfig │ └── string.js ├── spread │ ├── .flowconfig │ ├── test4.js │ └── test2.js ├── symlink │ ├── .flowconfig │ ├── bar.js │ ├── foo.js │ ├── qux.js │ └── symlink.exp ├── taint-libs │ ├── .flowconfig │ ├── .testconfig │ ├── lib │ │ └── goURI.js │ ├── test.sh │ ├── D2172778-fixed.js │ └── D2172778-tainted.js ├── this_ctor │ ├── .flowconfig │ └── this_ctor.exp ├── traits │ ├── .flowconfig │ └── test2.js ├── array_spread │ ├── .flowconfig │ ├── array_spread.exp │ └── test.js ├── bounded_poly │ ├── .flowconfig │ └── scope.js ├── builtin_uses │ ├── .flowconfig │ ├── test2.js │ ├── test.js │ └── builtin_uses.exp ├── class_statics │ └── .flowconfig ├── class_subtyping │ ├── .flowconfig │ ├── test.js │ ├── test2.js │ ├── test4.js │ └── test3.js ├── declare_fun │ ├── .flowconfig │ ├── declare_fun.exp │ └── test.js ├── export_type │ ├── .flowconfig │ ├── cjs_with_types.js │ └── types_only2.js ├── find-module │ ├── .flowconfig │ ├── .testconfig │ ├── req.js │ ├── test.js │ ├── find-module.exp │ └── test.sh ├── geolocation │ ├── .flowconfig │ └── geolocation.exp ├── object_annot │ ├── .flowconfig │ ├── object_annot.exp │ └── test.js ├── optional_props │ └── .flowconfig ├── sealed_objects │ └── .flowconfig ├── strict_requires │ ├── .flowconfig │ ├── A.js │ ├── B.js │ ├── C.js │ ├── D.js │ └── strict_requires.exp ├── type-at-pos │ ├── .flowconfig │ ├── .testconfig │ ├── import.js │ ├── test.js │ └── test.sh ├── unreachable │ ├── .flowconfig │ └── unreachable.exp ├── constructor_annots │ └── .flowconfig ├── es6modules │ ├── C.js │ ├── SideEffects.js │ ├── B.js │ ├── ProvidesModuleD.js │ ├── ES6_DefaultAndNamed.js │ ├── .flowconfig │ ├── ES6_ExportAllFrom_Source1.js │ ├── ES6_ExportAllFrom_Source2.js │ ├── ProvidesModuleCJSDefault.js │ ├── ES6_ExportFrom_Source1.js │ ├── ES6_ExportFrom_Source2.js │ ├── ES6_Default_AnonFunction1.js │ ├── ES6_Default_AnonFunction2.js │ ├── ES6_Default_AnonClass1.js │ ├── ES6_Default_AnonClass2.js │ ├── ES6_Default_NamedFunction1.js │ ├── ES6_Default_NamedFunction2.js │ ├── ES6_ExportAllFrom_Intermediary1.js │ ├── ES6_ExportAllFrom_Intermediary2.js │ ├── ProvidesModuleES6Default.js │ ├── ES6_Default_NamedClass2.js │ ├── ES6_ExportFrom_Intermediary1.js │ ├── ES6_ExportFrom_Intermediary2.js │ ├── ProvidesModuleA.js │ ├── CommonJS_Named.js │ └── CommonJS_Clobbering_Lit.js ├── immutable_methods │ ├── .flowconfig │ ├── immutable_methods.exp │ └── test.js ├── integration │ ├── bar.js │ ├── .testconfig │ ├── .flowconfig │ ├── foo.js │ ├── integration.exp │ └── test.sh ├── method_properties │ ├── .flowconfig │ └── test.js ├── parse_error_node │ ├── .flowconfig │ ├── .testconfig │ ├── parse_error_node.exp │ ├── Client.js │ ├── Imported.js │ └── Unimported.js ├── require │ ├── C.js │ ├── B.js │ ├── ProvidesModuleD.js │ ├── .flowconfig │ ├── ProvidesModuleA.js │ └── E.js ├── x │ ├── x.exp │ └── .flowconfig ├── flow_ast.template_strings │ ├── .flowconfig │ ├── foo.js │ └── .testconfig ├── for │ ├── for.exp │ └── .flowconfig ├── init │ ├── init.exp │ ├── .flowconfig │ └── nullable-init.js ├── path │ ├── path.exp │ ├── .flowconfig │ └── while.js ├── export_default │ ├── .flowconfig │ ├── P.js │ ├── test.js │ └── lib │ │ └── lib.js ├── funrec │ ├── funrec.exp │ ├── .flowconfig │ └── funrec.js ├── parse_error_haste │ ├── .testconfig │ ├── .flowconfig │ ├── Unimported.js │ ├── NoProvides.js │ └── parse_error_haste.exp ├── poly_overload │ ├── .flowconfig │ └── poly_overload.exp ├── static_overload │ ├── .flowconfig │ ├── static_overload.exp │ ├── test.js │ └── lib │ │ └── lib.js ├── symbol │ ├── symbol.exp │ ├── .flowconfig │ └── symbol.js ├── window │ ├── window.exp │ ├── .flowconfig │ ├── window2.js │ └── window1.js ├── abnormal │ ├── abnormal.exp │ ├── .flowconfig │ ├── return.js │ └── break-continue.js ├── autocomplete │ ├── .testconfig │ ├── .flowconfig │ ├── foo.js │ ├── foo_parse_fail.js │ ├── test.sh │ └── autocomplete.exp ├── declare_type │ ├── .flowconfig │ ├── lib │ │ └── DeclareModule_TypeAlias.js │ └── declare_type.exp ├── graphql │ ├── graphql.exp │ └── .flowconfig ├── incremental_basic │ ├── .testconfig │ ├── a.js │ ├── tmp2 │ │ └── a.js │ ├── .flowconfig │ ├── tmp1 │ │ └── b.js │ ├── b.js │ ├── c.js │ ├── tmp3 │ │ └── b.js │ └── test.sh ├── incremental_cycle │ ├── .testconfig │ ├── .flowconfig │ ├── A.js │ ├── tmp1 │ │ ├── B.js │ │ └── C.js │ ├── tmp2 │ │ └── B.js │ ├── tmp3 │ │ └── B.js │ ├── B.js │ ├── C.js │ └── test.sh ├── libdef_ignored_module │ ├── node_modules │ │ └── foo │ │ │ ├── index.js │ │ │ └── package.json │ ├── .flowconfig │ ├── lib │ │ └── foo.js │ ├── test.js │ └── libdef_ignored_module.exp ├── librec │ ├── libtest.js │ ├── lib │ │ ├── A │ │ │ └── libA.js │ │ └── B │ │ │ └── libB.js │ ├── .flowconfig │ └── librec.exp ├── replace │ ├── replace.exp │ ├── .flowconfig │ └── test.js ├── unicode │ ├── unicode.exp │ └── .flowconfig ├── version │ ├── .testconfig │ ├── .flowconfig │ └── version.exp ├── incremental │ ├── incremental.exp │ ├── a.js │ ├── dup_a.js │ ├── .flowconfig │ └── b.js ├── libconfig │ ├── libtest.js │ ├── libA.js │ ├── libB.js │ ├── .flowconfig │ └── libconfig.exp ├── refinements │ ├── node1.js │ ├── .flowconfig │ ├── lib.js │ ├── null.js │ ├── ast_node.js │ └── exists.js ├── suppress │ ├── lib.js │ ├── B.js │ ├── suppress.exp │ └── .flowconfig ├── suppress_bad │ ├── .testconfig │ ├── .flowconfig │ └── suppress_bad.exp ├── .flowconfig ├── lib_interfaces │ ├── lib_interfaces.exp │ ├── .flowconfig │ └── declarations │ │ └── underscore.js ├── liberr │ ├── .testconfig │ ├── libs │ │ ├── type_error.js │ │ └── parse_error.js │ ├── a.js │ └── .flowconfig ├── objects │ └── .flowconfig ├── annot │ ├── .flowconfig │ ├── other.js │ ├── test.js │ └── issue-530.js ├── arith │ ├── .flowconfig │ └── mult.js ├── arrays │ ├── .flowconfig │ └── arrays.exp ├── arrows │ ├── .flowconfig │ └── advanced_arrows.js ├── async │ ├── .flowconfig │ ├── async_promise.js │ ├── await_not_in_async.js │ ├── await_not_in_async2.js │ └── await_not_in_async3.js ├── break │ └── .flowconfig ├── canvas │ └── .flowconfig ├── classes │ ├── .flowconfig │ ├── D.js │ ├── A.js │ ├── B.js │ ├── loc.js │ └── C.js ├── closure │ └── .flowconfig ├── conditional │ ├── .flowconfig │ └── conditional.exp ├── cycle │ ├── .flowconfig │ ├── A.js │ ├── B.js │ └── cycle.exp ├── date │ └── .flowconfig ├── demo │ ├── 1 │ │ ├── .flowconfig │ │ └── f.js │ ├── 2 │ │ ├── .flowconfig │ │ └── B.js │ └── .flowconfig ├── encaps │ └── .flowconfig ├── equals │ ├── .flowconfig │ ├── equals.js │ └── equals.exp ├── get-def │ ├── .flowconfig │ ├── .testconfig │ ├── get-def.exp │ ├── library.js │ └── example.js ├── indexer │ └── .flowconfig ├── iter │ └── .flowconfig ├── lib │ ├── .flowconfig │ └── libtest.js ├── literal │ ├── .flowconfig │ └── enum.js ├── locals │ └── .flowconfig ├── logical │ └── .flowconfig ├── loners │ ├── .flowconfig │ ├── loners.exp │ └── loners.js ├── misc │ ├── .flowconfig │ ├── G.js │ ├── F.js │ ├── E.js │ ├── C.js │ ├── D.js │ ├── B.js │ └── A.js ├── modules │ ├── .flowconfig │ ├── cli2.js │ ├── cli.js │ ├── lib.js │ └── modules.exp ├── poly │ └── .flowconfig ├── refi │ ├── .flowconfig │ └── switch.js ├── regexp │ ├── .flowconfig │ ├── regexp.js │ └── regexp.exp ├── return │ └── .flowconfig ├── seal │ ├── .flowconfig │ ├── imp.js │ ├── seal.exp │ └── obj_annot.js ├── sealed │ ├── .flowconfig │ ├── function.js │ └── sealed.js ├── statics │ ├── .flowconfig │ ├── funstatics.js │ └── class_statics.js ├── strict │ ├── .flowconfig │ ├── obj.js │ ├── annot.js │ └── fun.js ├── suggest │ ├── .flowconfig │ ├── lib.js │ └── suggest.js ├── super │ ├── .flowconfig │ ├── import.js │ ├── test.js │ └── super.js ├── switch │ └── .flowconfig ├── this │ └── .flowconfig ├── tuples │ ├── .flowconfig │ ├── tuples.exp │ └── tuples.js ├── union │ ├── .flowconfig │ ├── issue-323-lib.js │ ├── test-lib.js │ ├── issue-323.js │ ├── fields.js │ ├── issue-324.js │ ├── issue-326.js │ ├── fields2.js │ ├── issue-256.js │ └── issue-198.js ├── value │ ├── .flowconfig │ ├── value.js │ └── value.exp ├── yield │ ├── .flowconfig │ ├── yield_arrow_error2.js │ ├── yield_arrow_error.js │ └── yield.exp ├── arraylib │ └── .flowconfig ├── builtins │ ├── .flowconfig │ └── genericfoo.js ├── callable │ ├── .flowconfig │ ├── callable.exp │ └── primitives.js ├── commonjs │ ├── .flowconfig │ ├── Rel.js │ ├── Abs.js │ └── commonjs.exp ├── constructor ├── docblock │ ├── .flowconfig │ └── docblock.exp ├── enumerror │ └── .flowconfig ├── fixpoint │ └── .flowconfig ├── generics │ └── .flowconfig ├── instanceof │ └── .flowconfig ├── interface │ ├── .flowconfig │ ├── import.js │ ├── interface.js │ └── test3.js ├── intersection │ ├── .flowconfig │ ├── intersection.js │ └── intersection.exp ├── keyvalue │ ├── .flowconfig │ └── keyvalue.js ├── more_annot │ ├── .flowconfig │ ├── client_object.js │ ├── super.js │ ├── more_annot.exp │ ├── proto.js │ └── object.js ├── more_classes │ ├── .flowconfig │ └── Qux.js ├── more_path │ ├── .flowconfig │ ├── FlowSA.js │ └── test.js ├── more_react │ ├── .flowconfig │ ├── JSX.js │ └── API.react.js ├── more_statics │ ├── .flowconfig │ ├── class_static.js │ └── more_statics.exp ├── namespace │ ├── .flowconfig │ └── client.js ├── nullable │ ├── .flowconfig │ └── simple_nullable.js ├── object_api │ ├── .flowconfig │ ├── a.js │ ├── c.js │ ├── b.js │ └── object_assign.js ├── optional │ ├── .flowconfig │ ├── client_optional.js │ ├── maybe.js │ ├── undefined2.js │ ├── undefined.js │ ├── optional_param3.js │ ├── optional_param2.js │ ├── optional.js │ └── optional_param4.js ├── plsummit │ ├── .flowconfig │ ├── import_class.js │ ├── generics.js │ ├── arrays.js │ ├── export_class.js │ └── locals.js ├── promises │ └── .flowconfig ├── qualified │ ├── .flowconfig │ ├── qualified.js │ └── qualified.exp ├── reflection │ ├── .flowconfig │ ├── type.js │ └── reflection.exp ├── type_param_variance │ ├── type_param_variance.exp │ └── .flowconfig ├── typecast │ ├── .flowconfig │ └── typecast.exp ├── undefined │ ├── .flowconfig │ ├── undefined2.js │ ├── undefined.exp │ └── undefined.js ├── weakmode │ ├── .flowconfig │ ├── weakmode.exp │ ├── should_fail_without_weak.js │ └── should_pass_with_weak.js ├── ast_tokens │ ├── .testconfig │ └── .flowconfig ├── destructuring │ ├── .flowconfig │ ├── destructuring_init.js │ └── destructuring_param.js ├── error_messages │ ├── .flowconfig │ ├── errors.js │ └── error_messages.exp ├── more_generics │ └── .flowconfig ├── number_constants │ └── .flowconfig ├── object_freeze │ └── .flowconfig ├── simple_arrays │ ├── .flowconfig │ ├── simple_arrays.exp │ └── array.js ├── type_param_variance2 │ ├── type_param_variance2.exp │ └── .flowconfig ├── config_file_extensions │ ├── .flowconfig │ ├── test.js.es6 │ ├── config_file_extensions.exp │ └── test.js ├── missing_annotation │ └── .flowconfig ├── config_munging_underscores │ ├── config_munging_underscores.exp │ └── .flowconfig ├── import_type │ ├── ExportsANumber.js │ ├── .flowconfig │ ├── issue-359.js │ ├── ExportNamed_Class.js │ ├── ExportDefault_Class.js │ ├── ExportNamed_Alias.js │ └── ExportCJSDefault_Class.js ├── import_typeof │ ├── ExportCJSNamed_Number.js │ ├── ExportDefault_Number.js │ ├── ExportNamed_Number.js │ ├── ExportCJSDefault_Number.js │ ├── .flowconfig │ ├── ExportCJSNamed_Class.js │ ├── ExportNamed_Class.js │ ├── ExportDefault_Class.js │ ├── ExportCJSDefault_Class.js │ └── ExportNamed_Alias.js ├── overload │ ├── .flowconfig │ ├── union.js │ ├── test.js │ ├── lib │ │ └── lib.js │ └── test2.js ├── declare_class │ ├── .flowconfig │ ├── declare_class.js │ └── lib │ │ └── test.js ├── esproposal_decorators.ignore │ ├── .flowconfig │ ├── esproposal_decorators.ignore.exp │ └── test.js ├── esproposal_decorators.warn │ ├── .flowconfig │ └── test.js ├── forof │ └── .flowconfig ├── function │ └── .flowconfig ├── include │ └── .flowconfig ├── iterable │ ├── .flowconfig │ ├── string.js │ └── iter.js ├── module_redirect │ ├── A.js │ ├── B.js │ ├── C.js │ ├── .flowconfig │ ├── D.js │ └── module_redirect.exp ├── new_react │ ├── .flowconfig │ └── Mixin.js ├── private │ ├── .flowconfig │ ├── private.exp │ └── private.js ├── traces │ └── .flowconfig ├── typeof │ └── .flowconfig ├── generators │ ├── .flowconfig │ ├── variance.js │ ├── async.js │ └── return.js ├── name_prop │ ├── .flowconfig │ └── function.js ├── object_assign │ ├── .flowconfig │ └── non_objects.js ├── call_properties │ └── .flowconfig ├── type_only_vars │ ├── .flowconfig │ ├── A.js │ └── type_alias.js ├── config_module_name_mapper_PROJECT_ROOT │ ├── src │ │ └── testmodule.js │ ├── .flowconfig │ ├── main.js │ └── config_module_name_mapper_PROJECT_ROOT.exp ├── esproposal_class_static_fields.warn │ ├── .flowconfig │ └── test.js ├── structural_subtyping │ ├── .flowconfig │ └── optional.js ├── config_munging_underscores2 │ └── .flowconfig ├── esproposal_class_instance_fields.ignore │ ├── esproposal_class_instance_fields.ignore.exp │ ├── .flowconfig │ └── test.js ├── esproposal_class_instance_fields.warn │ ├── .flowconfig │ └── test.js ├── esproposal_class_static_fields.ignore │ ├── .flowconfig │ ├── esproposal_class_static_fields.ignore.exp │ └── test.js ├── getters_and_setters_disabled │ ├── .flowconfig │ ├── getters_and_setters.js │ └── getters_and_setters_disabled.exp ├── config_module_name_rewrite_node │ ├── Exists.js │ └── node_modules │ │ └── Exists │ │ └── index.js ├── object_is │ ├── .flowconfig │ └── object_is.exp ├── suppress_traces │ ├── .testconfig │ └── .flowconfig ├── any │ ├── .flowconfig │ └── any.js ├── requireLazy │ ├── .flowconfig │ ├── A.js │ └── B.js ├── ignore_package │ ├── ignore_package.exp │ ├── .flowconfig │ └── node_modules │ │ └── underscore │ │ └── package.json ├── getters_and_setters_enabled │ ├── .flowconfig │ └── react.js ├── config_module_name_rewrite_haste │ ├── Exists.js │ └── config_module_name_rewrite_haste.exp └── config_module_system_node_resolve_dirname │ ├── custom_resolve_dir │ ├── testproj │ │ └── index.js │ └── testproj2 │ │ └── index.js │ ├── node_modules │ ├── testproj │ │ └── index.js │ └── testproj2 │ │ └── index.js │ ├── .flowconfig │ ├── subdir │ ├── custom_resolve_dir │ │ └── testproj2 │ │ │ └── index.js │ └── sublevel.js │ └── toplevel.js ├── auxiliary_tests ├── .flowconfig ├── basic_test.js ├── node_modules │ ├── Bar.js │ └── Foo_.js ├── type_test.js └── module_test.js ├── examples ├── 03_Null │ ├── .flowconfig │ ├── nulls.js │ └── answer │ │ └── nulls.js ├── 04_Arrays │ ├── .flowconfig │ ├── arrays.js │ └── answer │ │ └── arrays.js ├── flux-chat │ └── .flowconfig ├── 01_HelloWorld │ ├── .flowconfig │ ├── hello.js │ └── answer │ │ └── hello.js ├── 05_DynamicCode │ ├── .flowconfig │ ├── dynamic.js │ └── answer │ │ └── dynamic.js └── 02_TypeAnnotations │ ├── .flowconfig │ ├── type_annotations.js │ └── answer │ └── type_annotations.js ├── .flowconfig ├── hack ├── .gitignore ├── stubs │ └── filesToIgnore.ml ├── utils │ └── .gitignore ├── js │ └── ocaml_sys.js └── third-party │ ├── core │ ├── VERSION │ └── poly.ml │ └── inotify │ ├── origin.txt │ └── META ├── .merlin ├── .gitignore ├── auxiliary └── lib │ └── auxiliary.js └── CONTRIBUTING.md /src/typing/deps_js.ml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/react/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/rec/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/shape/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/taint/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/throw/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/try/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unary/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/while/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /auxiliary_tests/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/03_Null/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.out 2 | -------------------------------------------------------------------------------- /tests/auxiliary/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/binding/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/class_type/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/covariance/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/deps/F.js: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /tests/deps/H.js: -------------------------------------------------------------------------------- 1 | // empty 2 | -------------------------------------------------------------------------------- /tests/dictionary/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dump-types/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/extensions/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/issues-11/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/mixins/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_haste/ws/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parse/fail.js: -------------------------------------------------------------------------------- 1 | . 2 | -------------------------------------------------------------------------------- /tests/record/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/return_new/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/singleton/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/spread/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/symlink/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/symlink/bar.js: -------------------------------------------------------------------------------- 1 | foo.js -------------------------------------------------------------------------------- /tests/taint-libs/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/this_ctor/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/traits/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/04_Arrays/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/flux-chat/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/array_spread/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/bounded_poly/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/builtin_uses/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/class_statics/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/class_subtyping/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/declare_fun/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/export_type/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/find-module/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/geolocation/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/jsx/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/object_annot/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/optional_props/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/sealed_objects/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/strict_requires/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/type-at-pos/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unreachable/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /auxiliary_tests/basic_test.js: -------------------------------------------------------------------------------- 1 | XXX 2 | -------------------------------------------------------------------------------- /examples/01_HelloWorld/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/05_DynamicCode/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/constructor_annots/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/deps/A.js: -------------------------------------------------------------------------------- 1 | require('./C'); 2 | -------------------------------------------------------------------------------- /tests/deps/B.js: -------------------------------------------------------------------------------- 1 | require('./C'); 2 | -------------------------------------------------------------------------------- /tests/deps/D.js: -------------------------------------------------------------------------------- 1 | require('./I'); 2 | -------------------------------------------------------------------------------- /tests/deps/E.js: -------------------------------------------------------------------------------- 1 | require('./I'); 2 | -------------------------------------------------------------------------------- /tests/deps/G.js: -------------------------------------------------------------------------------- 1 | require('./H'); 2 | -------------------------------------------------------------------------------- /tests/deps/I.js: -------------------------------------------------------------------------------- 1 | require('./A'); 2 | -------------------------------------------------------------------------------- /tests/es6modules/C.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | -------------------------------------------------------------------------------- /tests/immutable_methods/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/integration/bar.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | -------------------------------------------------------------------------------- /tests/method_properties/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_haste/external/_d3/min.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/basic/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/jsx_file/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/stream/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parse_error_node/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/require/C.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | -------------------------------------------------------------------------------- /tests/x/x.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | -------------------------------------------------------------------------------- /examples/02_TypeAnnotations/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/deps/deps.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/flow_ast.template_strings/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/for/for.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/init/init.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/node_tests/basic_file/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/basic_package/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/child_process/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/package_file/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/path_package/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/path/path.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /hack/.gitignore: -------------------------------------------------------------------------------- 1 | *.bc 2 | *.opt 3 | !Makefile 4 | -------------------------------------------------------------------------------- /tests/auxiliary/client.js: -------------------------------------------------------------------------------- 1 | var y:number = x; 2 | -------------------------------------------------------------------------------- /tests/dump-types/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh 2 | -------------------------------------------------------------------------------- /tests/es6modules/SideEffects.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | -------------------------------------------------------------------------------- /tests/export_default/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | lib -------------------------------------------------------------------------------- /tests/find-module/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh 2 | -------------------------------------------------------------------------------- /tests/find-module/req.js: -------------------------------------------------------------------------------- 1 | module.exports = 0; 2 | -------------------------------------------------------------------------------- /tests/funrec/funrec.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/integration/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh 2 | -------------------------------------------------------------------------------- /tests/node_tests/basic_node_modules/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parse_error_haste/.testconfig: -------------------------------------------------------------------------------- 1 | all: false -------------------------------------------------------------------------------- /tests/parse_error_node/.testconfig: -------------------------------------------------------------------------------- 1 | all: false -------------------------------------------------------------------------------- /tests/poly_overload/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | decls -------------------------------------------------------------------------------- /tests/shape/shape.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/static_overload/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | lib -------------------------------------------------------------------------------- /tests/symbol/symbol.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/taint-libs/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh 2 | -------------------------------------------------------------------------------- /tests/type-at-pos/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh 2 | -------------------------------------------------------------------------------- /tests/while/while.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/window/window.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /src/parser/tools/.gitignore: -------------------------------------------------------------------------------- 1 | native_test_files 2 | -------------------------------------------------------------------------------- /tests/abnormal/abnormal.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/autocomplete/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh 2 | -------------------------------------------------------------------------------- /tests/auxiliary/lib/lib.js: -------------------------------------------------------------------------------- 1 | declare var x: string; 2 | -------------------------------------------------------------------------------- /tests/declare_type/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | lib 3 | -------------------------------------------------------------------------------- /tests/graphql/graphql.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/incremental_basic/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh -------------------------------------------------------------------------------- /tests/incremental_cycle/.testconfig: -------------------------------------------------------------------------------- 1 | shell: test.sh -------------------------------------------------------------------------------- /tests/libdef_ignored_module/node_modules/foo/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/librec/libtest.js: -------------------------------------------------------------------------------- 1 | foo(123); 2 | bar(123); 3 | -------------------------------------------------------------------------------- /tests/node_haste/md5.js: -------------------------------------------------------------------------------- 1 | /* @providesModule md5 */ 2 | -------------------------------------------------------------------------------- /tests/node_haste/node_modules/qux/corge/lib/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/invalid_package_file/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_tests/invalid_package_file/package.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/parse/fail-flow.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | . 4 | -------------------------------------------------------------------------------- /tests/replace/replace.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/unicode/unicode.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/version/.testconfig: -------------------------------------------------------------------------------- 1 | ignore_stderr: false 2 | -------------------------------------------------------------------------------- /.merlin: -------------------------------------------------------------------------------- 1 | S hack/** 2 | S src/** 3 | 4 | B _build/** 5 | -------------------------------------------------------------------------------- /tests/class_type/class_type.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/geolocation/geolocation.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/incremental/incremental.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/libconfig/libtest.js: -------------------------------------------------------------------------------- 1 | foo(123); 2 | bar(123); 3 | -------------------------------------------------------------------------------- /tests/libdef_ignored_module/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/node_haste/client.js: -------------------------------------------------------------------------------- 1 | var md5 = require('./md5'); 2 | -------------------------------------------------------------------------------- /tests/node_tests/basic/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/jsx/bar.jsx: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/package_file_node_modules/.flowconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/refinements/node1.js: -------------------------------------------------------------------------------- 1 | module.exports = 'Node1'; 2 | -------------------------------------------------------------------------------- /tests/suppress/lib.js: -------------------------------------------------------------------------------- 1 | declare var library_num: number; 2 | -------------------------------------------------------------------------------- /tests/suppress_bad/.testconfig: -------------------------------------------------------------------------------- 1 | ignore_stderr: false 2 | -------------------------------------------------------------------------------- /hack/stubs/filesToIgnore.ml: -------------------------------------------------------------------------------- 1 | let should_ignore _ = false 2 | -------------------------------------------------------------------------------- /tests/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | traces=2 -------------------------------------------------------------------------------- /tests/array_spread/array_spread.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/export_default/P.js: -------------------------------------------------------------------------------- 1 | module.exports = require('M'); 2 | -------------------------------------------------------------------------------- /tests/flow_ast.template_strings/foo.js: -------------------------------------------------------------------------------- 1 | a`foo ${bar} baz` 2 | -------------------------------------------------------------------------------- /tests/incremental/a.js: -------------------------------------------------------------------------------- 1 | /* @providesModule IncrModuleA */ 2 | -------------------------------------------------------------------------------- /tests/integration/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | strip_root=true 3 | -------------------------------------------------------------------------------- /tests/integration/foo.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | require('./bar'); 3 | -------------------------------------------------------------------------------- /tests/lib_interfaces/lib_interfaces.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/liberr/.testconfig: -------------------------------------------------------------------------------- 1 | cmd: status --old-output-format 2 | -------------------------------------------------------------------------------- /tests/node_haste/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste -------------------------------------------------------------------------------- /tests/node_haste/external/_d3/package.json: -------------------------------------------------------------------------------- 1 | { "name": "d3" } 2 | -------------------------------------------------------------------------------- /tests/node_haste/ws/test/client.js: -------------------------------------------------------------------------------- 1 | var ws = require('../'); 2 | -------------------------------------------------------------------------------- /tests/node_tests/basic_file/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/jsx_file/bar.jsx: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/object_annot/object_annot.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/objects/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | -------------------------------------------------------------------------------- /tests/parse/fail-flow-2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow */ 3 | 4 | . 5 | -------------------------------------------------------------------------------- /tests/poly_overload/poly_overload.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/x/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /auxiliary_tests/node_modules/Bar.js: -------------------------------------------------------------------------------- 1 | /* @providesModule Bar */ 2 | -------------------------------------------------------------------------------- /auxiliary_tests/node_modules/Foo_.js: -------------------------------------------------------------------------------- 1 | /* @providesModule Foo */ 2 | -------------------------------------------------------------------------------- /auxiliary_tests/type_test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | var _:number = XXX; 3 | -------------------------------------------------------------------------------- /src/dts/tests/numbered_keys/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | declarations 3 | -------------------------------------------------------------------------------- /tests/annot/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/annot/other.js: -------------------------------------------------------------------------------- 1 | class C { } 2 | module.exports = (C: any); 3 | -------------------------------------------------------------------------------- /tests/arith/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/arrays/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/arrows/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/async/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/break/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/canvas/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/classes/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/classes/D.js: -------------------------------------------------------------------------------- 1 | class D { } 2 | class E { } 3 | new E().x 4 | -------------------------------------------------------------------------------- /tests/closure/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/conditional/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | -------------------------------------------------------------------------------- /tests/cycle/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/date/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/demo/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/demo/1/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/demo/2/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/deps/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/encaps/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/equals/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/for/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/funrec/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/get-def/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/graphql/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/indexer/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/init/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/iter/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/lib/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/libconfig/libA.js: -------------------------------------------------------------------------------- 1 | declare function foo(x: number): void; 2 | -------------------------------------------------------------------------------- /tests/libconfig/libB.js: -------------------------------------------------------------------------------- 1 | declare function bar(x: string): void; 2 | -------------------------------------------------------------------------------- /tests/literal/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/locals/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/logical/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/loners/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/misc/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/modules/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/node_tests/package_file/bar_lib/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = 0; 2 | -------------------------------------------------------------------------------- /tests/parse/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/path/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/poly/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/refi/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/regexp/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/replace/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/return/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/seal/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/sealed/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/static_overload/static_overload.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/statics/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/strict/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/strict_requires/A.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | module.exports = 0; 3 | -------------------------------------------------------------------------------- /tests/suggest/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/super/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/switch/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/symbol/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/this/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/tuples/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/unicode/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/union/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/value/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/window/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/yield/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/abnormal/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/annot/test.js: -------------------------------------------------------------------------------- 1 | var C = require('./other'); 2 | ((0: C): string); 3 | -------------------------------------------------------------------------------- /tests/arraylib/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/builtins/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/callable/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/commonjs/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/commonjs/Rel.js: -------------------------------------------------------------------------------- 1 | 2 | var f = require('./Abs'); 3 | 4 | f(0); 5 | -------------------------------------------------------------------------------- /tests/constructor/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/docblock/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/enumerror/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/es6modules/B.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | exports.numberValue = 42; 4 | -------------------------------------------------------------------------------- /tests/extensions/bar.jsx: -------------------------------------------------------------------------------- 1 | module.exports = function (p: string) {} 2 | -------------------------------------------------------------------------------- /tests/extensions/foo.js: -------------------------------------------------------------------------------- 1 | var imp = require('./bar'); 2 | imp(1337); 3 | -------------------------------------------------------------------------------- /tests/fixpoint/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/generics/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/instanceof/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/interface/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/intersection/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/keyvalue/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/librec/lib/A/libA.js: -------------------------------------------------------------------------------- 1 | declare function foo(x: number): void; 2 | -------------------------------------------------------------------------------- /tests/librec/lib/B/libB.js: -------------------------------------------------------------------------------- 1 | declare function bar(x: string): void; 2 | -------------------------------------------------------------------------------- /tests/mixins/Bar.js: -------------------------------------------------------------------------------- 1 | var Bar = { x: 0 }; 2 | module.exports = Bar; 3 | -------------------------------------------------------------------------------- /tests/more_annot/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/more_classes/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/more_path/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/more_react/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/more_statics/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/namespace/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/node_tests/basic_package/bar_lib/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/package_file/bar_lib.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar_lib"; 2 | -------------------------------------------------------------------------------- /tests/nullable/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/object_api/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/object_api/a.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | module.exports = { a() {} }; -------------------------------------------------------------------------------- /tests/optional/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/plsummit/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/promises/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/qualified/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/reflection/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/require/B.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | exports.numberValue = 42; 4 | -------------------------------------------------------------------------------- /tests/static_overload/test.js: -------------------------------------------------------------------------------- 1 | var x: number = StaticOverload.foo(0); 2 | -------------------------------------------------------------------------------- /tests/type_param_variance/type_param_variance.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/typecast/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/undefined/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/weakmode/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /hack/utils/.gitignore: -------------------------------------------------------------------------------- 1 | # CMake/Makefile codegen file 2 | get_build_id.gen.c 3 | -------------------------------------------------------------------------------- /tests/ast_tokens/.testconfig: -------------------------------------------------------------------------------- 1 | cmd: ast --tokens --pretty 2 | stdin: foo.js 3 | -------------------------------------------------------------------------------- /tests/destructuring/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/error_messages/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/more_generics/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/node_haste/node_modules/qux/corge/package.json: -------------------------------------------------------------------------------- 1 | { "main": "lib" } 2 | -------------------------------------------------------------------------------- /tests/number_constants/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/object_freeze/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/parse_error_haste/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/simple_arrays/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/strict_requires/B.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | module.exports = { foo: "" } 3 | -------------------------------------------------------------------------------- /tests/suppress/B.js: -------------------------------------------------------------------------------- 1 | // $FlowFixMe 2 | var test1: string = library_num; 3 | -------------------------------------------------------------------------------- /tests/symlink/foo.js: -------------------------------------------------------------------------------- 1 | class Foo { x: number; } 2 | module.exports = Foo; 3 | -------------------------------------------------------------------------------- /tests/type_param_variance/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | -------------------------------------------------------------------------------- /tests/type_param_variance2/type_param_variance2.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /src/dts/tests/union/declarations/union.d.ts: -------------------------------------------------------------------------------- 1 | declare var x : number | string; 2 | -------------------------------------------------------------------------------- /src/dts/tests/union/declarations/union.js.exp: -------------------------------------------------------------------------------- 1 | declare var x: number | string; 2 | -------------------------------------------------------------------------------- /src/stubs/haste_module_preprocessor.mli: -------------------------------------------------------------------------------- 1 | val preprocess_name: string -> string 2 | -------------------------------------------------------------------------------- /tests/builtin_uses/test2.js: -------------------------------------------------------------------------------- 1 | var o = require('./test'); 2 | (o.foo: string); 3 | -------------------------------------------------------------------------------- /tests/config_file_extensions/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.file_ext=.js.es6 3 | -------------------------------------------------------------------------------- /tests/demo/2/B.js: -------------------------------------------------------------------------------- 1 | var A = require('Demo'); 2 | 3 | var z = new A("42").getX(); 4 | -------------------------------------------------------------------------------- /tests/get-def/.testconfig: -------------------------------------------------------------------------------- 1 | cmd: get-def example.js 12 10 --strip-root --json 2 | -------------------------------------------------------------------------------- /tests/issues-11/export.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | exports.x = 1; 3 | exports.y = ""; 4 | -------------------------------------------------------------------------------- /tests/missing_annotation/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | -------------------------------------------------------------------------------- /tests/node_tests/basic/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('./bar.js'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/basic_node_modules/node_modules/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/jsx/foo.jsx: -------------------------------------------------------------------------------- 1 | var x = require('./bar.jsx'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/replace/test.js: -------------------------------------------------------------------------------- 1 | var a = 0; 2 | 3 | function foo(x) { } 4 | 5 | foo(""); 6 | -------------------------------------------------------------------------------- /tests/symlink/qux.js: -------------------------------------------------------------------------------- 1 | import type Foo from './bar.js'; 2 | ({ x: "" }: Foo); 3 | -------------------------------------------------------------------------------- /tests/traits/test2.js: -------------------------------------------------------------------------------- 1 | declare interface I { } 2 | declare class C mixins I { } 3 | -------------------------------------------------------------------------------- /hack/js/ocaml_sys.js: -------------------------------------------------------------------------------- 1 | 2 | function caml_sys_getenv () { 3 | return ''; 4 | } 5 | -------------------------------------------------------------------------------- /src/dts/tests/numbered_keys/numbered_keys.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var z : string = x["0"]; 3 | -------------------------------------------------------------------------------- /tests/commonjs/Abs.js: -------------------------------------------------------------------------------- 1 | 2 | function f(x:string) { } 3 | 4 | module.exports = f; 5 | -------------------------------------------------------------------------------- /tests/config_munging_underscores/config_munging_underscores.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/error_messages/errors.js: -------------------------------------------------------------------------------- 1 | if (typeof define === 'function' && define.amd) { } 2 | -------------------------------------------------------------------------------- /tests/import_type/ExportsANumber.js: -------------------------------------------------------------------------------- 1 | /* @ flow */ 2 | 3 | export var numValue = 42; 4 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportCJSNamed_Number.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | exports.num = 42; 4 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportDefault_Number.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export default 42; 4 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportNamed_Number.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export var num = 42; 4 | -------------------------------------------------------------------------------- /tests/incremental_basic/a.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var a: string = 0; 3 | module.exports = a; 4 | -------------------------------------------------------------------------------- /tests/incremental_basic/tmp2/a.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var a = 0; 3 | module.exports = a; 4 | -------------------------------------------------------------------------------- /tests/liberr/libs/type_error.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | declare function foo(x: number): Array; 3 | -------------------------------------------------------------------------------- /tests/optional/client_optional.js: -------------------------------------------------------------------------------- 1 | var qux = require('./optional'); 2 | 3 | qux(0); 4 | -------------------------------------------------------------------------------- /tests/optional/maybe.js: -------------------------------------------------------------------------------- 1 | function foo(x?: string): ?string { 2 | return x; 3 | } 4 | -------------------------------------------------------------------------------- /tests/overload/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | lib 3 | 4 | [options] 5 | module.system=haste 6 | -------------------------------------------------------------------------------- /tests/require/ProvidesModuleD.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule D 3 | * @flow 4 | */ 5 | -------------------------------------------------------------------------------- /tests/taint-libs/lib/goURI.js: -------------------------------------------------------------------------------- 1 | declare function goURI(uri : $Tainted) : void; 2 | -------------------------------------------------------------------------------- /tests/union/issue-323-lib.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | class Foo {} 3 | module.exports = Foo; 4 | -------------------------------------------------------------------------------- /src/dts/tests/enums/declarations/enums.d.ts: -------------------------------------------------------------------------------- 1 | declare enum Color { 2 | R, G, B 3 | } 4 | -------------------------------------------------------------------------------- /src/dts/tests/union/union.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var a : number = x; 3 | var b : typeof x = 5; 4 | -------------------------------------------------------------------------------- /tests/annot/issue-530.js: -------------------------------------------------------------------------------- 1 | function foo(...args: any) { } 2 | 3 | module.exports = foo; 4 | -------------------------------------------------------------------------------- /tests/declare_class/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | lib 3 | 4 | [options] 5 | module.system=haste 6 | -------------------------------------------------------------------------------- /tests/es6modules/ProvidesModuleD.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule D 3 | * @flow 4 | */ 5 | -------------------------------------------------------------------------------- /tests/esproposal_decorators.ignore/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | esproposal.decorators=ignore 3 | -------------------------------------------------------------------------------- /tests/esproposal_decorators.ignore/esproposal_decorators.ignore.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/esproposal_decorators.warn/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | esproposal.decorators=warn 3 | -------------------------------------------------------------------------------- /tests/flow_ast.template_strings/.testconfig: -------------------------------------------------------------------------------- 1 | cmd: ast --tokens --pretty 2 | stdin: foo.js 3 | -------------------------------------------------------------------------------- /tests/forof/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/function/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/get-def/get-def.exp: -------------------------------------------------------------------------------- 1 | {"path":"library.js","line":5,"endline":7,"start":17,"end":3} 2 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportCJSDefault_Number.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | module.exports = 42; 4 | -------------------------------------------------------------------------------- /tests/include/.flowconfig: -------------------------------------------------------------------------------- 1 | [include] 2 | ../lib 3 | [options] 4 | module.system=haste 5 | 6 | -------------------------------------------------------------------------------- /tests/incremental/dup_a.js: -------------------------------------------------------------------------------- 1 | /* @providesModule IncrModuleA */ 2 | 3 | var x:string = 0; 4 | -------------------------------------------------------------------------------- /tests/iterable/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/keyvalue/keyvalue.js: -------------------------------------------------------------------------------- 1 | var files = new FileList(); 2 | var x: number = files[""]; 3 | -------------------------------------------------------------------------------- /tests/module_redirect/A.js: -------------------------------------------------------------------------------- 1 | declare module A { 2 | declare function foo(): string; 3 | } 4 | -------------------------------------------------------------------------------- /tests/modules/cli2.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var f = require('./lib'); 4 | 5 | f("..."); 6 | -------------------------------------------------------------------------------- /tests/new_react/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | fakelib 3 | 4 | [options] 5 | module.system=haste 6 | -------------------------------------------------------------------------------- /tests/node_tests/basic_node_modules/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('bar.js'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/package_file_node_modules/node_modules/bar_lib.js: -------------------------------------------------------------------------------- 1 | module.exports = 0; 2 | -------------------------------------------------------------------------------- /tests/node_tests/path_package/node_modules/bar_lib/src/lib/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/object_api/c.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var c = require('./b'); 4 | c.a(); 5 | c.foo(); -------------------------------------------------------------------------------- /tests/private/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | munge_underscores=true 4 | -------------------------------------------------------------------------------- /tests/qualified/qualified.js: -------------------------------------------------------------------------------- 1 | class C { } 2 | var M = { C: C }; 3 | 4 | var x:M.C = 0; 5 | -------------------------------------------------------------------------------- /tests/traces/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | traces=3 4 | strip_root=true -------------------------------------------------------------------------------- /tests/typeof/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/yield/yield_arrow_error2.js: -------------------------------------------------------------------------------- 1 | function * f () { 2 | var e = () => yield 1; 3 | } 4 | -------------------------------------------------------------------------------- /tests/ast_tokens/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/autocomplete/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/classes/A.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo(x:number):void { } 3 | } 4 | 5 | module.exports = A; 6 | -------------------------------------------------------------------------------- /tests/deps/C.js: -------------------------------------------------------------------------------- 1 | require('./D'); 2 | require('./E'); 3 | require('./F'); 4 | require('./G'); 5 | -------------------------------------------------------------------------------- /tests/generators/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/import_type/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/import_typeof/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/incremental/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*dup.* 3 | [options] 4 | module.system=haste 5 | 6 | -------------------------------------------------------------------------------- /tests/name_prop/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/namespace/client.js: -------------------------------------------------------------------------------- 1 | var ns = require('./namespace') 2 | 3 | var bar: string = ns.foo 4 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules/node_modules/bar_lib/src/lib/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/path_package/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('bar_lib/src/lib'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/object_assign/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/plsummit/import_class.js: -------------------------------------------------------------------------------- 1 | var C = require('./export_class'); 2 | 3 | var c = new C(""); 4 | -------------------------------------------------------------------------------- /tests/refinements/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | [libs] 5 | lib.js 6 | -------------------------------------------------------------------------------- /tests/regexp/regexp.js: -------------------------------------------------------------------------------- 1 | var patt=/Hello/g 2 | var match:number = patt.test("Hello world!"); 3 | -------------------------------------------------------------------------------- /tests/window/window2.js: -------------------------------------------------------------------------------- 1 | /* @providesModule Window2 */ 2 | 3 | module.exports = window.parent; 4 | -------------------------------------------------------------------------------- /tests/yield/yield_arrow_error.js: -------------------------------------------------------------------------------- 1 | function * f () { 2 | var e = () => { yield 1; }; 3 | } 4 | -------------------------------------------------------------------------------- /src/dts/tests/numbered_keys/declarations/numbered_keys.d.ts: -------------------------------------------------------------------------------- 1 | declare var x : {0: number; 1: string}; 2 | -------------------------------------------------------------------------------- /tests/call_properties/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/incremental_basic/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/tmp* 3 | 4 | [options] 5 | strip_root=true 6 | -------------------------------------------------------------------------------- /tests/incremental_cycle/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/tmp* 3 | 4 | [options] 5 | strip_root=true 6 | -------------------------------------------------------------------------------- /tests/libdef_ignored_module/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/node_modules/.* 3 | 4 | [libs] 5 | ./lib 6 | -------------------------------------------------------------------------------- /tests/libdef_ignored_module/lib/foo.js: -------------------------------------------------------------------------------- 1 | declare module foo { 2 | declare var bar: number; 3 | } 4 | -------------------------------------------------------------------------------- /tests/modules/cli.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var f = require('./lib'); 4 | 5 | var y:number = f(0); 6 | -------------------------------------------------------------------------------- /tests/more_annot/client_object.js: -------------------------------------------------------------------------------- 1 | var o = require('./object'); 2 | 3 | var a:number = o.w.z.y; 4 | -------------------------------------------------------------------------------- /tests/node_tests/basic_node_modules_with_path/node_modules/bar_lib/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/basic_package/bar_lib/package.json: -------------------------------------------------------------------------------- 1 | { "name": "bar_lib", 2 | "main": "./bar.js" } 3 | -------------------------------------------------------------------------------- /tests/node_tests/package_file/bar_lib/package.json: -------------------------------------------------------------------------------- 1 | { "name": "bar_lib", 2 | "main": "./bar.js" } 3 | -------------------------------------------------------------------------------- /tests/node_tests/package_file_node_modules/foo/node_modules/bar_lib/bar.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/seal/imp.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var imp = require('./obj_annot'); 4 | imp({ name: "imp" }); 5 | -------------------------------------------------------------------------------- /tests/super/import.js: -------------------------------------------------------------------------------- 1 | class D { 2 | foo(): number { return 0; } 3 | } 4 | module.exports = D; 5 | -------------------------------------------------------------------------------- /tests/taint-libs/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | FLOW=$1 3 | 4 | $FLOW check . --strip-root --lib lib/ 5 | -------------------------------------------------------------------------------- /tests/type_only_vars/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/type_param_variance2/.flowconfig: -------------------------------------------------------------------------------- 1 | [libs] 2 | libs/ 3 | 4 | [options] 5 | module.system=haste 6 | -------------------------------------------------------------------------------- /tests/union/test-lib.js: -------------------------------------------------------------------------------- 1 | /* @providesModule test-lib */ 2 | 3 | class C { } 4 | module.exports = C; 5 | -------------------------------------------------------------------------------- /tests/window/window1.js: -------------------------------------------------------------------------------- 1 | /* 2 | @providesModule Window1 3 | */ 4 | module.exports = window.history; 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *TAGS 2 | _build 3 | .DS_STORE 4 | docs/_site/ 5 | bin 6 | npm-debug.log 7 | *.diff 8 | *.err 9 | -------------------------------------------------------------------------------- /src/dts/tests/functions/functions.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var x: C = f (5); 3 | var y: string = f(1, "test"); 4 | -------------------------------------------------------------------------------- /tests/auxiliary/real_node_modules/symlink_lib_outside_root/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { bar: "bar" }; 2 | -------------------------------------------------------------------------------- /tests/classes/B.js: -------------------------------------------------------------------------------- 1 | var A = require('./A'); 2 | 3 | class B extends A { } 4 | 5 | module.exports = B; 6 | -------------------------------------------------------------------------------- /tests/config_module_name_mapper_PROJECT_ROOT/src/testmodule.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export let test = 42; 4 | -------------------------------------------------------------------------------- /tests/cycle/A.js: -------------------------------------------------------------------------------- 1 | var B = require('./B'); 2 | 3 | class A extends B { } 4 | 5 | module.exports = A; 6 | -------------------------------------------------------------------------------- /tests/cycle/B.js: -------------------------------------------------------------------------------- 1 | var A = require('./A'); 2 | 3 | //class B extends A { } 4 | 5 | module.exports = B; 6 | -------------------------------------------------------------------------------- /tests/esproposal_class_static_fields.warn/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | esproposal.class_static_fields=warn 3 | -------------------------------------------------------------------------------- /tests/find-module/test.js: -------------------------------------------------------------------------------- 1 | var x = require('./req'); 2 | (x: string); 3 | 4 | import x from './req'; 5 | -------------------------------------------------------------------------------- /tests/init/nullable-init.js: -------------------------------------------------------------------------------- 1 | var o: {x: ?number} = { x: null }; 2 | var a: Array = [null,null]; 3 | -------------------------------------------------------------------------------- /tests/node_tests/basic_file/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('./bar'); // bar.js does not work 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/basic_node_modules_with_path/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('bar_lib/bar'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/jsx_file/foo.jsx: -------------------------------------------------------------------------------- 1 | var x = require('./bar'); // bar.js does not work 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('bar_lib/src/lib/bar'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_short_main/node_modules/bar_lib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_symlinks/node_modules/symlink_lib: -------------------------------------------------------------------------------- 1 | ../real_node_modules/symlink_lib -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_without_main/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('bar_lib'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_without_main/node_modules/bar_lib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = "bar"; 2 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_without_main/node_modules/bar_lib/package.json: -------------------------------------------------------------------------------- 1 | {"name":"bar_lib"} 2 | -------------------------------------------------------------------------------- /tests/refinements/lib.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | declare var BAZ: {stuff?: (x: number) => void} | void; 4 | -------------------------------------------------------------------------------- /tests/structural_subtyping/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/undefined/undefined2.js: -------------------------------------------------------------------------------- 1 | var id; 2 | var name = id ? 'John' : undefined; 3 | module.exports = name; 4 | -------------------------------------------------------------------------------- /src/dts/tests/.gitignore: -------------------------------------------------------------------------------- 1 | # ignore files generated by src/dts/runtests.sh 2 | */declarations/*.js 3 | *.out 4 | -------------------------------------------------------------------------------- /src/dts/tests/classes/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/classes/classes.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var a : C = new D(); 3 | var a : D = new C(); // Error: C ~> D 4 | -------------------------------------------------------------------------------- /src/dts/tests/enums/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/modules/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/union/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/async/async_promise.js: -------------------------------------------------------------------------------- 1 | async function f(): Promise { 2 | return Promise.resolve(1); 3 | } 4 | -------------------------------------------------------------------------------- /tests/builtin_uses/test.js: -------------------------------------------------------------------------------- 1 | var o = Object.freeze({ foo: 0 }); 2 | (o.foo: string); 3 | module.exports = o; 4 | -------------------------------------------------------------------------------- /tests/class_subtyping/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | class A {} 3 | class B {} 4 | 5 | module.exports = { A, B }; 6 | -------------------------------------------------------------------------------- /tests/classes/loc.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | type Foo = number 4 | 5 | class Foo {} // error, shadows type Foo 6 | -------------------------------------------------------------------------------- /tests/config_munging_underscores2/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/cycle/cycle.exp: -------------------------------------------------------------------------------- 1 | 2 | B.js:5:18,18: identifier `B` 3 | Could not resolve name 4 | 5 | Found 1 error 6 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_DefaultAndNamed.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export default 42; 4 | export var str = 'asdf'; 5 | -------------------------------------------------------------------------------- /tests/esproposal_class_instance_fields.ignore/esproposal_class_instance_fields.ignore.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/esproposal_class_instance_fields.warn/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | esproposal.class_instance_fields=warn 3 | -------------------------------------------------------------------------------- /tests/esproposal_class_static_fields.ignore/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | esproposal.class_static_fields=ignore 3 | -------------------------------------------------------------------------------- /tests/esproposal_class_static_fields.ignore/esproposal_class_static_fields.ignore.exp: -------------------------------------------------------------------------------- 1 | 2 | Found 0 errors 3 | -------------------------------------------------------------------------------- /tests/getters_and_setters_disabled/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/import_type/issue-359.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | class ClassFoo6 {}; 4 | 5 | export default ClassFoo6; 6 | -------------------------------------------------------------------------------- /tests/incremental_basic/tmp1/b.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var a = require('./a'); 3 | var b = a; 4 | module.exports = b; 5 | -------------------------------------------------------------------------------- /tests/interface/import.js: -------------------------------------------------------------------------------- 1 | interface I { x: number } 2 | export type J = I; // workaround for export interface 3 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_short_main/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('bar_lib'); 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /hack/third-party/core/VERSION: -------------------------------------------------------------------------------- 1 | 112.01.00 of Jane Street's core_kernel (https://github.com/janestreet/core_kernel) 2 | -------------------------------------------------------------------------------- /hack/third-party/inotify/origin.txt: -------------------------------------------------------------------------------- 1 | http://projects.snarc.org/ocaml-inotify/download/ocaml_inotify-1.0.tar.bz2 2 | -------------------------------------------------------------------------------- /src/dts/tests/functions/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/modules2/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/type_alias/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/arith/mult.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function num(x:number) { } 4 | 5 | num(null * 1); 6 | num(1 * null); 7 | -------------------------------------------------------------------------------- /tests/config_module_name_rewrite_node/Exists.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | module.exports = { 4 | numVal: 42 5 | }; 6 | -------------------------------------------------------------------------------- /tests/destructuring/destructuring_init.js: -------------------------------------------------------------------------------- 1 | var {foo}; 2 | var [bar]; 3 | var []; 4 | var {}; 5 | var [], {toz}; 6 | -------------------------------------------------------------------------------- /tests/dump-types/import.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var num = 42; 3 | function bar() { } 4 | bar(); 5 | module.exports = num; 6 | -------------------------------------------------------------------------------- /tests/esproposal_class_instance_fields.ignore/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | esproposal.class_instance_fields=ignore 3 | -------------------------------------------------------------------------------- /tests/incremental/b.js: -------------------------------------------------------------------------------- 1 | /* @providesModule IncrModuleB 2 | @flow 3 | */ 4 | 5 | var A = require('IncrModuleA'); 6 | -------------------------------------------------------------------------------- /tests/incremental_basic/b.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var a = require('./a'); 3 | var b: number = a; 4 | module.exports = b; 5 | -------------------------------------------------------------------------------- /tests/incremental_basic/c.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var b = require('./b'); 3 | var c: string = b; 4 | module.exports = c; 5 | -------------------------------------------------------------------------------- /tests/integration/integration.exp: -------------------------------------------------------------------------------- 1 | 2 | foo.js:2:1,16: bar.js 3 | Required module not found 4 | 5 | Found 1 error 6 | -------------------------------------------------------------------------------- /tests/lib_interfaces/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations 7 | 8 | [options] 9 | -------------------------------------------------------------------------------- /tests/more_annot/super.js: -------------------------------------------------------------------------------- 1 | class C { m() { } } 2 | class D extends C { } 3 | 4 | var d: { m(): void } = new D(); 5 | -------------------------------------------------------------------------------- /tests/new_react/Mixin.js: -------------------------------------------------------------------------------- 1 | /* @providesModule Mixin */ 2 | module.exports = { 3 | success: function() { } 4 | }; 5 | -------------------------------------------------------------------------------- /tests/object_is/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | module.system=haste 9 | -------------------------------------------------------------------------------- /tests/require/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | module.system=haste 9 | -------------------------------------------------------------------------------- /tests/spread/test4.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | function test(...nums: Array) {} 3 | 4 | test(0, ...[1, 2, 3]); 5 | -------------------------------------------------------------------------------- /tests/suppress_traces/.testconfig: -------------------------------------------------------------------------------- 1 | cmd: check --all --strip-root --old-output-format --show-all-errors --traces 10 2 | -------------------------------------------------------------------------------- /tests/type-at-pos/import.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var num = 42; 3 | function bar() { } 4 | bar(); 5 | module.exports = num; 6 | -------------------------------------------------------------------------------- /src/dts/tests/export_modules/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/import_commonjs/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/interface_var/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/nested_modules/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /src/dts/tests/var_interface/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | declarations/ 7 | [options] 8 | -------------------------------------------------------------------------------- /tests/any/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system=haste 3 | 4 | suppress_type=$FlowIssue 5 | suppress_type=$FlowFixMe 6 | -------------------------------------------------------------------------------- /tests/demo/1/f.js: -------------------------------------------------------------------------------- 1 | /* demo */ 2 | 3 | function f(x) { return 42/x; } 4 | 5 | var x = null; 6 | //... 7 | 8 | f(x); 9 | -------------------------------------------------------------------------------- /tests/es6modules/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | module.system=haste 9 | -------------------------------------------------------------------------------- /tests/export_type/cjs_with_types.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export type talias4 = number; 4 | 5 | module.exports = {} 6 | -------------------------------------------------------------------------------- /tests/export_type/types_only2.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | export type talias1 = number; 4 | export type talias2 = number; 5 | -------------------------------------------------------------------------------- /tests/incremental_basic/tmp3/b.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var a = require('./a'); 3 | var b: number = a; 4 | module.exports = b; 5 | -------------------------------------------------------------------------------- /tests/module_redirect/B.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule B 3 | * @flow 4 | */ 5 | 6 | module.exports = require('A'); 7 | -------------------------------------------------------------------------------- /tests/module_redirect/C.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule C 3 | * @flow 4 | */ 5 | 6 | module.exports = require('B'); 7 | -------------------------------------------------------------------------------- /tests/node_tests/basic_package/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('./bar_lib'); // 'bar_lib' does not work! 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/path_package/node_modules/bar_lib/src/lib/package.json: -------------------------------------------------------------------------------- 1 | { "name": "bar_lib", 2 | "main": "bar.js" } 3 | -------------------------------------------------------------------------------- /tests/plsummit/generics.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var r: number = 0; 4 | function foo(x: X): X { r = x; return x; } 5 | -------------------------------------------------------------------------------- /tests/require/ProvidesModuleA.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule A 3 | * @flow 4 | */ 5 | 6 | exports.numberValue = 42; 7 | -------------------------------------------------------------------------------- /tests/requireLazy/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | module.system=haste 9 | -------------------------------------------------------------------------------- /tests/suggest/lib.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function bar(w: number): number { return w; } 4 | 5 | module.exports = bar; 6 | -------------------------------------------------------------------------------- /tests/suppress_bad/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | suppress_comment=[ 9 | -------------------------------------------------------------------------------- /src/dts/tests/export_modules/export_modules.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var P = require("module-P"); 3 | var x : string = (new P.C()).y; 4 | -------------------------------------------------------------------------------- /tests/ignore_package/ignore_package.exp: -------------------------------------------------------------------------------- 1 | 2 | foo.js:8:9,29: underscore 3 | Required module not found 4 | 5 | Found 1 error 6 | -------------------------------------------------------------------------------- /tests/integration/test.sh: -------------------------------------------------------------------------------- 1 | FLOW=$1 2 | 3 | mv bar.js _bar.js 4 | $FLOW status --old-output-format . 5 | mv _bar.js bar.js 6 | -------------------------------------------------------------------------------- /tests/issues-11/import.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | var e = require('./export'); 3 | var x: string = e.x; 4 | var y: number = e.y; 5 | -------------------------------------------------------------------------------- /tests/libconfig/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | libA.js 7 | libB.js 8 | 9 | [options] 10 | -------------------------------------------------------------------------------- /tests/liberr/a.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | // one error here, to verify lib errors sort to top. 5 | var x: string = 0; 6 | -------------------------------------------------------------------------------- /tests/literal/enum.js: -------------------------------------------------------------------------------- 1 | var APIKeys = { 2 | AGE: 'age', 3 | NAME: 'name', 4 | }; 5 | 6 | module.exports = APIKeys; 7 | -------------------------------------------------------------------------------- /tests/node_tests/node_tests.exp: -------------------------------------------------------------------------------- 1 | 2 | invalid_package_file/package.json:1:3,2: Unexpected end of input 3 | 4 | Found 1 error 5 | -------------------------------------------------------------------------------- /tests/node_tests/package_file/foo.js: -------------------------------------------------------------------------------- 1 | var x: string = require('./bar_lib'); // 'bar_lib' does not work! 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_short_main/node_modules/bar_lib/package.json: -------------------------------------------------------------------------------- 1 | {"name":"bar_lib", "main": "./index"} 2 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_symlinks/real_node_modules/symlink_lib/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { bar: "bar" }; 2 | -------------------------------------------------------------------------------- /tests/union/issue-323.js: -------------------------------------------------------------------------------- 1 | var Foo = require("./issue-323-lib"); 2 | var foo = new Foo(); 3 | var foostr: Foo | string = foo; 4 | -------------------------------------------------------------------------------- /examples/01_HelloWorld/hello.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(x) { 4 | return x*10; 5 | } 6 | 7 | foo("Hello, world!"); 8 | -------------------------------------------------------------------------------- /src/dts/tests/numbered_keys/declarations/numbered_keys.js.exp: -------------------------------------------------------------------------------- 1 | declare var x: {"0": number; 2 | "1": string;}; 3 | -------------------------------------------------------------------------------- /src/dts/tests/type_alias/type_alias.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var M = require('M'); 3 | var a : number = M.x; 4 | var b : typeof M.x = 5; 5 | -------------------------------------------------------------------------------- /src/parser/.gitignore: -------------------------------------------------------------------------------- 1 | lex_test 2 | parse_test 3 | lexer_flow.ml 4 | flow_parser.js 5 | perf_test 6 | pfff_test 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /tests/config_module_name_mapper_PROJECT_ROOT/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.name_mapper='^\(.*\)' -> '/src/\1' 3 | -------------------------------------------------------------------------------- /tests/dump-types/test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var num = require('./import'); 3 | function foo() { } 4 | foo(); 5 | var a:string = num; 6 | -------------------------------------------------------------------------------- /tests/ignore_package/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*node_modules/underscore.* 3 | 4 | [include] 5 | 6 | [libs] 7 | 8 | [options] 9 | -------------------------------------------------------------------------------- /tests/incremental_cycle/A.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | class A { 4 | b: number; 5 | c: string; 6 | } 7 | 8 | module.exports = A; 9 | -------------------------------------------------------------------------------- /tests/liberr/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | libs/ 7 | 8 | [options] 9 | strip_root=true 10 | -------------------------------------------------------------------------------- /tests/librec/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | lib 7 | 8 | [options] 9 | module.system=haste 10 | -------------------------------------------------------------------------------- /tests/node_haste/node_haste.exp: -------------------------------------------------------------------------------- 1 | 2 | foo/bar/client.js:7:19,39: annotation 3 | Required module not found 4 | 5 | Found 1 error 6 | -------------------------------------------------------------------------------- /tests/node_tests/package_file_node_modules/foo/node_modules/bar_lib/package.json: -------------------------------------------------------------------------------- 1 | { "name": "bar_lib", 2 | "main": "./bar.js" } 3 | -------------------------------------------------------------------------------- /tests/union/fields.js: -------------------------------------------------------------------------------- 1 | class C { 2 | x: ?number|string; 3 | constructor() { 4 | this.x = null; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/version/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | 9 | [version] 10 | 0.1.0 11 | -------------------------------------------------------------------------------- /tests/version/version.exp: -------------------------------------------------------------------------------- 1 | .flowconfig:10 Wrong version of Flow. The config specifies version 0.1.0 but this is version 0.18.1 2 | -------------------------------------------------------------------------------- /tests/auxiliary/real_node_modules/symlink_lib_outside_root/package.json: -------------------------------------------------------------------------------- 1 | {"name": "symlink_lib_outside_root", "main": "./index.js"} 2 | -------------------------------------------------------------------------------- /tests/config_module_name_rewrite_node/node_modules/Exists/index.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | module.exports = { 4 | numVal: 42 5 | }; 6 | -------------------------------------------------------------------------------- /tests/config_munging_underscores/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | munge_underscores=true 9 | -------------------------------------------------------------------------------- /tests/error_messages/error_messages.exp: -------------------------------------------------------------------------------- 1 | 2 | errors.js:1:12,17: identifier `define` 3 | Could not resolve name 4 | 5 | Found 1 error 6 | -------------------------------------------------------------------------------- /tests/generators/variance.js: -------------------------------------------------------------------------------- 1 | declare var g1: Generator; 2 | var g2: Generator = g1; 3 | -------------------------------------------------------------------------------- /tests/libdef_ignored_module/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import foo from "foo"; 4 | 5 | (foo.bar : string); // error number ~> string 6 | -------------------------------------------------------------------------------- /tests/node_tests/assert/assert.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var assert = require("assert") 4 | assert(true) // ok 5 | assert.ok(true) // ok 6 | -------------------------------------------------------------------------------- /tests/plsummit/arrays.js: -------------------------------------------------------------------------------- 1 | function foo(x) { return [x, x > 0, "number " + x]; } 2 | 3 | var [n, b, s] = foo(42); 4 | n * s.length; 5 | -------------------------------------------------------------------------------- /tests/suppress_traces/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | suppress_comment=.*\\$FlowFixMe.* 9 | -------------------------------------------------------------------------------- /src/dts/tests/functions/declarations/functions.d.ts: -------------------------------------------------------------------------------- 1 | function f(num:number, str:string):C; 2 | declare class C { 3 | x : number 4 | } 5 | -------------------------------------------------------------------------------- /tests/autocomplete/foo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | var obj = { 6 | num: 123, 7 | str: 'hello', 8 | }; 9 | 10 | obj. 11 | -------------------------------------------------------------------------------- /tests/classes/C.js: -------------------------------------------------------------------------------- 1 | var B = require('./B'); 2 | 3 | class C extends B { 4 | foo(x:string):void { } 5 | } 6 | 7 | module.exports = C; 8 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportCJSNamed_Class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class ClassFoo4 {} 6 | 7 | exports.ClassFoo4 = ClassFoo4; 8 | -------------------------------------------------------------------------------- /tests/incremental_cycle/tmp1/B.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var A = require ('./A'); 3 | import type * as C from './C'; 4 | 5 | export type B = string; 6 | -------------------------------------------------------------------------------- /tests/module_redirect/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | A.js 7 | 8 | [options] 9 | module.system=haste 10 | -------------------------------------------------------------------------------- /tests/node_tests/package_file_node_modules/foo/foo.js: -------------------------------------------------------------------------------- 1 | var x: string = require('bar_lib'); // 'bar_lib' does not work! 2 | console.log(x); 3 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_symlinks/real_node_modules/symlink_lib/package.json: -------------------------------------------------------------------------------- 1 | {"name": "symlink_lib", "main": "./index.js"} 2 | -------------------------------------------------------------------------------- /tests/strict_requires/C.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | var o = { 3 | A: require('./A'), 4 | ...require('./B'), 5 | }; 6 | module.exports = o; 7 | -------------------------------------------------------------------------------- /tests/strict_requires/D.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | var C = require('./C'); 3 | var x: number = C.foo; 4 | var y: string = C.A; 5 | C.A = false; 6 | -------------------------------------------------------------------------------- /tests/suppress_bad/suppress_bad.exp: -------------------------------------------------------------------------------- 1 | .flowconfig:8 Error parsing value for "suppress_comment". Invalid regex "[" ([ class not closed by ]) 2 | -------------------------------------------------------------------------------- /tests/this_ctor/this_ctor.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:1:7,7: A 3 | This type is incompatible with 4 | test.js:9:15,20: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/throw/throw.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:13:12,12: string 3 | This type is incompatible with 4 | test.js:13:12,14: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /src/dts/tests/classes/classes.exp: -------------------------------------------------------------------------------- 1 | 2 | classes.js:2:9,9: C 3 | This type is incompatible with 4 | classes.js:3:9,9: D 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/incremental_cycle/tmp2/B.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var A = require ('./A'); 3 | //import type * as C from './C'; 4 | 5 | export type B = string; 6 | -------------------------------------------------------------------------------- /tests/incremental_cycle/tmp3/B.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var A = require ('./A'); 3 | import type * as C from './C'; 4 | 5 | 6 | export type B = string; 7 | -------------------------------------------------------------------------------- /tests/misc/G.js: -------------------------------------------------------------------------------- 1 | var a = { length: "duck" }; 2 | a.length = 123; 3 | a.length(); 4 | 5 | var b = [ 123 ]; 6 | b.length = "duck"; 7 | b.length(); 8 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_symlinks/node_modules/symlink_lib_outside_root: -------------------------------------------------------------------------------- 1 | ../../../auxiliary/real_node_modules/symlink_lib_outside_root -------------------------------------------------------------------------------- /tests/plsummit/export_class.js: -------------------------------------------------------------------------------- 1 | class C { 2 | x: number; 3 | constructor(x: number) { this.x = x; } 4 | } 5 | 6 | module.exports = C; 7 | -------------------------------------------------------------------------------- /tests/static_overload/lib/lib.js: -------------------------------------------------------------------------------- 1 | declare class StaticOverload { 2 | static foo(x: number): number; 3 | static foo(x: string): string; 4 | } 5 | -------------------------------------------------------------------------------- /tests/symbol/symbol.js: -------------------------------------------------------------------------------- 1 | var FOO = Symbol(); 2 | var BAR = Symbol('bar'); 3 | 4 | // TODO: Expected error 5 | var WAT = Symbol('foo', 'bar'); 6 | -------------------------------------------------------------------------------- /tests/tuples/tuples.exp: -------------------------------------------------------------------------------- 1 | 2 | tuples.js:6:33,35: number 3 | This type is incompatible with 4 | tuples.js:6:17,22: string 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /examples/03_Null/nulls.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function length(x) { 4 | return x.length; 5 | } 6 | 7 | var total = length("Hello") + length(null); 8 | -------------------------------------------------------------------------------- /examples/05_DynamicCode/dynamic.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(x) { 4 | return x.length; 5 | } 6 | 7 | var res = foo("Hello") + foo(42); 8 | -------------------------------------------------------------------------------- /src/dts/tests/classes/declarations/classes.js.exp: -------------------------------------------------------------------------------- 1 | declare class C { 2 | x: number; 3 | } 4 | declare class D extends C { 5 | y: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/dts/tests/functions/declarations/functions.js.exp: -------------------------------------------------------------------------------- 1 | declare function f(num: number, str: string): C; 2 | declare class C { 3 | x: number; 4 | } 5 | -------------------------------------------------------------------------------- /tests/abnormal/return.js: -------------------------------------------------------------------------------- 1 | function bar(x:number) { } 2 | function foo() { 3 | var x = null; 4 | if (x == null) return; 5 | bar(x); 6 | } 7 | -------------------------------------------------------------------------------- /tests/ignore_package/node_modules/underscore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "underscore", 3 | "main": "underscore.js", 4 | "version": "1.8.3" 5 | } 6 | -------------------------------------------------------------------------------- /tests/loners/loners.exp: -------------------------------------------------------------------------------- 1 | 2 | loners.js:2:11,11: property `z` 3 | Property not found in 4 | loners.js:2:9,9: object literal 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/qualified/qualified.exp: -------------------------------------------------------------------------------- 1 | 2 | qualified.js:4:13,13: number 3 | This type is incompatible with 4 | qualified.js:4:7,9: C 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/seal/seal.exp: -------------------------------------------------------------------------------- 1 | 2 | obj_annot.js:4:18,19: property `id` 3 | Property not found in 4 | obj_annot.js:4:12,16: object type 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/shape/test.js: -------------------------------------------------------------------------------- 1 | type Foo = { 2 | field: number, 3 | } 4 | 5 | var x: {field?: number} = {}; 6 | var y: $Shape = x; 7 | (y.field: number) 8 | -------------------------------------------------------------------------------- /src/dts/tests/classes/declarations/classes.d.ts: -------------------------------------------------------------------------------- 1 | declare class C { 2 | x : number 3 | } 4 | 5 | declare class D extends C { 6 | y : string 7 | } 8 | -------------------------------------------------------------------------------- /src/dts/tests/type_alias/declarations/type_alias.d.ts: -------------------------------------------------------------------------------- 1 | declare module M { 2 | type NumString = number | string 3 | export var x : NumString 4 | } 5 | -------------------------------------------------------------------------------- /tests/bounded_poly/scope.js: -------------------------------------------------------------------------------- 1 | function foo(x:X, y:Y):void { } 2 | foo(0, ""); 3 | 4 | function bar(x:X, y:Y): number { return y*0; } 5 | -------------------------------------------------------------------------------- /tests/declare_fun/declare_fun.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:7:2,11: boolean 3 | This type is incompatible with 4 | test.js:7:14,17: undefined 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/dump-types/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | FLOW=$1 3 | 4 | $FLOW dump-types --strip-root --json test.js 5 | $FLOW dump-types --strip-root --raw test.js 6 | -------------------------------------------------------------------------------- /tests/getters_and_setters_enabled/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [options] 8 | unsafe.enable_getters_and_setters=true 9 | -------------------------------------------------------------------------------- /tests/optional/undefined2.js: -------------------------------------------------------------------------------- 1 | var x; 2 | 3 | function foo(bar?) { 4 | x = bar; 5 | } 6 | 7 | function bar() { 8 | return x.duck; 9 | } 10 | -------------------------------------------------------------------------------- /tests/simple_arrays/simple_arrays.exp: -------------------------------------------------------------------------------- 1 | 2 | array.js:4:30,30: number 3 | This type is incompatible with 4 | array.js:8:18,23: string 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/typecast/typecast.exp: -------------------------------------------------------------------------------- 1 | 2 | typecast.js:7:14,18: string 3 | This type is incompatible with 4 | typecast.js:7:22,27: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/value/value.js: -------------------------------------------------------------------------------- 1 | var o = {}; 2 | o["x"] = 4; 3 | var y:string = o["x"]; 4 | 5 | var table: { [_: string]: number } = {}; 6 | table["x"] = "hello"; 7 | -------------------------------------------------------------------------------- /auxiliary_tests/module_test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | var Foo = require('Foo'); 3 | var Bar = require('Bar'); 4 | 5 | var x:number = Foo.x; 6 | var y:number = Bar.y; 7 | -------------------------------------------------------------------------------- /tests/config_file_extensions/test.js.es6: -------------------------------------------------------------------------------- 1 | /* 2 | * @flow 3 | */ 4 | 5 | function foo(x) { 6 | return x * 10; 7 | } 8 | 9 | foo('Hello, world!'); 10 | -------------------------------------------------------------------------------- /tests/config_module_name_rewrite_haste/Exists.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule Exists 3 | * @flow 4 | */ 5 | 6 | module.exports = { 7 | numVal: 42 8 | }; 9 | -------------------------------------------------------------------------------- /tests/declare_class/declare_class.js: -------------------------------------------------------------------------------- 1 | declare class C { 2 | static x: number; 3 | static foo(x: number): void; 4 | } 5 | 6 | C.x = ""; 7 | C.foo(""); 8 | -------------------------------------------------------------------------------- /tests/dictionary/test_client.js: -------------------------------------------------------------------------------- 1 | var o = require('./test'); 2 | 3 | o.foo = function (params) { 4 | return params.count; // error, number ~/~ string 5 | } 6 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportAllFrom_Source1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportAllFrom_Source1 3 | * @flow 4 | */ 5 | 6 | export var numberValue1 = 1; 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportAllFrom_Source2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportAllFrom_Source2 3 | * @flow 4 | */ 5 | 6 | export var numberValue1 = 1; 7 | -------------------------------------------------------------------------------- /tests/funrec/funrec.js: -------------------------------------------------------------------------------- 1 | function bar(x) { return x; } 2 | function foo() { 3 | return function bound() { 4 | return bar(bound); 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/overload/union.js: -------------------------------------------------------------------------------- 1 | function foo (x: $Either,U>): Array { return []; } 2 | 3 | var x1:number = foo(0)[0]; 4 | var x2:string = foo([""])[0]; 5 | -------------------------------------------------------------------------------- /tests/yield/yield.exp: -------------------------------------------------------------------------------- 1 | 2 | yield_arrow_error.js:2:25,25: Unexpected number 3 | 4 | yield_arrow_error2.js:2:23,23: Unexpected number 5 | 6 | Found 2 errors 7 | -------------------------------------------------------------------------------- /hack/third-party/inotify/META: -------------------------------------------------------------------------------- 1 | version="1.0" 2 | description="Linux inotify" 3 | requires="unix" 4 | archive(byte)="inotify.cma" 5 | archive(native)="inotify.cmxa" 6 | -------------------------------------------------------------------------------- /src/dts/tests/modules2/modules2.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var M = require('M.N');; 3 | 4 | var x : M.C = new M.C(); 5 | var z : typeof M.x = x.y; 6 | var m : string = z; 7 | -------------------------------------------------------------------------------- /tests/abnormal/break-continue.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | while(true) { break; } 3 | } 4 | 5 | function bar() { 6 | L: do { continue L; } while(false) 7 | } 8 | -------------------------------------------------------------------------------- /tests/autocomplete/foo_parse_fail.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | var obj = { 6 | num: 123, 7 | str: 'hello', 8 | }; 9 | 10 | console.log(obj. 11 | -------------------------------------------------------------------------------- /tests/callable/callable.exp: -------------------------------------------------------------------------------- 1 | 2 | primitives.js:6:1,6: function call 3 | Callable signature not found in 4 | primitives.js:6:1,4: object type 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export var name: "otherdir/testproj" = "otherdir/testproj"; 4 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/node_modules/testproj/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export var name: "node_modules/testproj" = "node_modules/testproj"; 4 | -------------------------------------------------------------------------------- /tests/es6modules/ProvidesModuleCJSDefault.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule CJSDefault 3 | * @flow 4 | */ 5 | 6 | module.exports = { 7 | numberValue: 42 8 | }; 9 | -------------------------------------------------------------------------------- /tests/misc/F.js: -------------------------------------------------------------------------------- 1 | function fn2(x) { return x.length * 4; } 2 | fn2({length: 'hi'}); 3 | 4 | function foo(x: Array): string { 5 | return x.length; 6 | } 7 | -------------------------------------------------------------------------------- /tests/more_annot/more_annot.exp: -------------------------------------------------------------------------------- 1 | 2 | client_object.js:3:16,22: string 3 | This type is incompatible with 4 | client_object.js:3:7,12: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/object_assign/non_objects.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | Object.assign("123", {a: "foo"}); 4 | Object.assign(123, {a: "foo"}); 5 | Object.assign({a: "foo"}, 123); 6 | -------------------------------------------------------------------------------- /tests/optional/undefined.js: -------------------------------------------------------------------------------- 1 | var x; 2 | 3 | function foo(bar? = undefined) { 4 | x = bar; 5 | } 6 | 7 | function bar() { 8 | return x.duck; 9 | } 10 | -------------------------------------------------------------------------------- /tests/path/while.js: -------------------------------------------------------------------------------- 1 | var x = 1; 2 | while(typeof x == "number" || typeof x == "string") { 3 | x = x + 1; 4 | if (true) x = ""; 5 | } 6 | var z:number = x; 7 | -------------------------------------------------------------------------------- /tests/singleton/string.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | type NoSpaces = "foobar" 4 | ("foobar": NoSpaces); 5 | 6 | type HasSpaces = "foo bar" 7 | ("foo bar": HasSpaces); 8 | -------------------------------------------------------------------------------- /src/dts/tests/modules2/declarations/modules2.d.ts: -------------------------------------------------------------------------------- 1 | declare module M.N { 2 | export var x: number 3 | export class C { 4 | y : typeof x 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/class_subtyping/test2.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | var I = require("./test.js"); 3 | 4 | class C extends I.A {} 5 | 6 | var x: I.A = new C(); 7 | var y: I.B = new C(); 8 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/custom_resolve_dir/testproj2/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export var name: "otherdir/testproj2" = "otherdir/testproj2"; 4 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/node_modules/testproj2/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export var name: "node_modules/testproj2" = "node_modules/testproj2"; 4 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportFrom_Source1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportFrom_Source1 3 | * @flow 4 | */ 5 | 6 | export var numberValue1 = 1, numberValue2 = 2; 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportFrom_Source2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportFrom_Source2 3 | * @flow 4 | */ 5 | 6 | export var numberValue1 = 1, numberValue2 = 2; 7 | -------------------------------------------------------------------------------- /tests/interface/interface.js: -------------------------------------------------------------------------------- 1 | declare class C { x: number; } 2 | 3 | var x: string = new C().x; 4 | 5 | interface I { x: number; } 6 | 7 | var i = new I(); // error 8 | -------------------------------------------------------------------------------- /tests/libdef_ignored_module/libdef_ignored_module.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:5:2,8: number 3 | This type is incompatible with 4 | test.js:5:12,17: string 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/mixins/test.js: -------------------------------------------------------------------------------- 1 | var Bar = require('./Bar'); 2 | 3 | class Foo extends mixin(Bar) { 4 | m() { 5 | var x: string = this.x; 6 | this.y = ""; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/object_api/b.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var a = require('./a'); 4 | var b = Object.assign({ bar() {}, ...{} }, a); 5 | b.a(); // works here 6 | module.exports = b; 7 | -------------------------------------------------------------------------------- /tests/overload/test.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var output = new FakeUint8Array(); 3 | output.set(new FakeUint8Array(), 0); // matches one of the overloads of set 4 | } 5 | -------------------------------------------------------------------------------- /tests/spread/test2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | function foo(o) { 6 | bar({...o}); 7 | } 8 | function bar(_: {foo:number}) { } 9 | foo({foo: 42}); 10 | -------------------------------------------------------------------------------- /tests/statics/funstatics.js: -------------------------------------------------------------------------------- 1 | function C() { } 2 | C.prototype.f = function() { return C.g(0); } 3 | C.g = function(x) { return x; }; 4 | 5 | var x:string = new C().f(); 6 | -------------------------------------------------------------------------------- /examples/02_TypeAnnotations/type_annotations.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(x: string, y: number): string { 4 | return x.length * y; 5 | } 6 | 7 | foo("Hello", 42); 8 | -------------------------------------------------------------------------------- /src/dts/tests/interface_var/interface_var.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var agelimit: number = adult; 3 | var another_attempt: number = adult.minage; 4 | var tom : adult = new adult(); 5 | -------------------------------------------------------------------------------- /src/dts/tests/var_interface/var_interface.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var agelimit: number = adult; 3 | var another_attempt: number = adult.minage; 4 | var tom : adult = new adult(); 5 | -------------------------------------------------------------------------------- /tests/constructor/constructor.exp: -------------------------------------------------------------------------------- 1 | 2 | constructor.js:6:19,24: return undefined 3 | This type is incompatible with 4 | constructor.js:6:19,24: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/constructor/constructor.js: -------------------------------------------------------------------------------- 1 | class C { 2 | constructor() { } 3 | } 4 | 5 | class D { 6 | constructor():number { } 7 | } 8 | 9 | module.exports = C; 10 | -------------------------------------------------------------------------------- /tests/node_haste/node_modules/qux/docblock.js: -------------------------------------------------------------------------------- 1 | var x = 0; 2 | /* 3 | This @providesModule annotation is unreachable, since it 4 | follows an executable statement. 5 | */ 6 | -------------------------------------------------------------------------------- /tests/requireLazy/A.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule A 3 | * @flow 4 | */ 5 | 6 | module.exports = { 7 | numberValueA: 1, 8 | stringValueA: "someString" 9 | }; 10 | -------------------------------------------------------------------------------- /tests/requireLazy/B.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule B 3 | * @flow 4 | */ 5 | 6 | module.exports = { 7 | numberValueB: 1, 8 | stringValueB: "someString" 9 | }; 10 | -------------------------------------------------------------------------------- /auxiliary/lib/auxiliary.js: -------------------------------------------------------------------------------- 1 | declare var XXX: string; 2 | declare module Foo { 3 | declare var x: string; 4 | } 5 | declare module Bar { 6 | declare var y: string; 7 | } 8 | -------------------------------------------------------------------------------- /examples/01_HelloWorld/answer/hello.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(x) { 4 | return x*10; 5 | } 6 | 7 | // This is fine, because we're passing a number now 8 | foo(10); 9 | -------------------------------------------------------------------------------- /src/dts/tests/import_commonjs/import_commonjs.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var P = require("module-P"); 3 | var x : string = (new P.C()).y; 4 | var M = require("M"); 5 | var z: number = M.m; 6 | -------------------------------------------------------------------------------- /src/dts/tests/numbered_keys/numbered_keys.exp: -------------------------------------------------------------------------------- 1 | 2 | numbered_keys.js:2:18,23: number 3 | This type is incompatible with 4 | numbered_keys.js:2:9,14: string 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/.flowconfig: -------------------------------------------------------------------------------- 1 | [options] 2 | module.system.node.resolve_dirname=node_modules 3 | module.system.node.resolve_dirname=custom_resolve_dir 4 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_Default_AnonFunction1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_Default_AnonFunction1 3 | * @flow 4 | */ 5 | 6 | export default function():number { return 42; } 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_Default_AnonFunction2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_Default_AnonFunction2 3 | * @flow 4 | */ 5 | 6 | export default function():number { return 42; } 7 | -------------------------------------------------------------------------------- /tests/node_tests/path_node_modules_with_symlinks/foo.js: -------------------------------------------------------------------------------- 1 | var x = require('symlink_lib'); 2 | var y = require('symlink_lib_outside_root'); 3 | console.log(x); 4 | console.log(y); 5 | -------------------------------------------------------------------------------- /tests/optional/optional_param3.js: -------------------------------------------------------------------------------- 1 | function foo(x?: number) {} 2 | foo(undefined); // ok 3 | 4 | function bar(x = "bar"): string { 5 | return x; 6 | } 7 | bar(undefined); // ok 8 | -------------------------------------------------------------------------------- /tests/super/test.js: -------------------------------------------------------------------------------- 1 | var D = require('./import'); 2 | class C extends D { 3 | constructor() { return super(); } 4 | foo() { return super.foo(); } 5 | } 6 | module.exports = C; 7 | -------------------------------------------------------------------------------- /src/dts/tests/interface_var/declarations/interface_var.js.exp: -------------------------------------------------------------------------------- 1 | declare class adult { 2 | height: number; 3 | age: number; 4 | static minage: number; 5 | new(): adult; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /src/dts/tests/var_interface/declarations/var_interface.js.exp: -------------------------------------------------------------------------------- 1 | declare class adult { 2 | height: number; 3 | age: number; 4 | static minage: number; 5 | new(): adult; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /tests/autocomplete/test.sh: -------------------------------------------------------------------------------- 1 | FLOW=$1 2 | 3 | $FLOW autocomplete --strip-root foo_parse_fail.js 10 17 < foo_parse_fail.js 4 | $FLOW autocomplete --strip-root --json foo.js 10 5 < foo.js 5 | -------------------------------------------------------------------------------- /tests/commonjs/commonjs.exp: -------------------------------------------------------------------------------- 1 | 2 | Rel.js:4:1,4: function call 3 | Error: 4 | Rel.js:4:3,3: number 5 | This type is incompatible with 6 | Abs.js:2:14,19: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_Default_AnonClass1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_Default_AnonClass1 3 | * @flow 4 | */ 5 | 6 | export default class { givesANum(): number { return 42; }}; 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_Default_AnonClass2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_Default_AnonClass2 3 | * @flow 4 | */ 5 | 6 | export default class { givesANum(): number { return 42; }}; 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_Default_NamedFunction1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_Default_NamedFunction1 3 | * @flow 4 | */ 5 | 6 | export default function foo():number { return 42; } 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_Default_NamedFunction2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_Default_NamedFunction2 3 | * @flow 4 | */ 5 | 6 | export default function foo():number { return 42; } 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportAllFrom_Intermediary1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportAllFrom_Intermediary1 3 | * @flow 4 | */ 5 | 6 | export * from "ES6_ExportAllFrom_Source1"; 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportAllFrom_Intermediary2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportAllFrom_Intermediary2 3 | * @flow 4 | */ 5 | 6 | export * from "ES6_ExportAllFrom_Source2"; 7 | -------------------------------------------------------------------------------- /tests/es6modules/ProvidesModuleES6Default.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6Default 3 | * @flow 4 | */ 5 | 6 | /* 7 | export default { 8 | numberValue: 42, 9 | }; 10 | */ 11 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportNamed_Class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class ClassFoo2 { 6 | returnsANumber(): number { return 42; } 7 | } 8 | 9 | export {ClassFoo2}; 10 | -------------------------------------------------------------------------------- /tests/more_annot/proto.js: -------------------------------------------------------------------------------- 1 | function Foo() { this.x = 0; } 2 | Foo.prototype.m = function() { } 3 | 4 | var o1: { x: number; m(): void } = new Foo(); 5 | 6 | var o2: Foo = new Foo(); 7 | -------------------------------------------------------------------------------- /tests/overload/lib/lib.js: -------------------------------------------------------------------------------- 1 | declare class FakeUint8Array { 2 | set(index: number, value: number): void; 3 | set(array: FakeUint8Array | Array, offset?: number): void; 4 | } 5 | -------------------------------------------------------------------------------- /tests/type-at-pos/test.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var str = require('./import'); 3 | function foo() { } 4 | foo(); 5 | str 6 | 7 | type Point = [number, string]; 8 | const x:Point = [1, "foo"]; 9 | -------------------------------------------------------------------------------- /tests/weakmode/weakmode.exp: -------------------------------------------------------------------------------- 1 | 2 | should_fail_without_weak.js:9:10,27: string 3 | This type is incompatible with 4 | should_fail_without_weak.js:9:10,32: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /src/dts/tests/interface_var/interface_var.exp: -------------------------------------------------------------------------------- 1 | 2 | interface_var.js:2:24,28: class type: adult 3 | This type is incompatible with 4 | interface_var.js:2:15,20: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /src/dts/tests/var_interface/var_interface.exp: -------------------------------------------------------------------------------- 1 | 2 | var_interface.js:2:24,28: class type: adult 3 | This type is incompatible with 4 | var_interface.js:2:15,20: number 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/arrays/arrays.exp: -------------------------------------------------------------------------------- 1 | 2 | Arrays.js:10:1,9: function call 3 | Error: 4 | Arrays.js:10:5,8: number 5 | This type is incompatible with 6 | Arrays.js:4:16,21: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/config_module_name_mapper_PROJECT_ROOT/main.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import {test} from 'testmodule'; 4 | 5 | var a: number = test; 6 | var b: string = test; // Error: number ~> string 7 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_Default_NamedClass2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_Default_NamedClass2 3 | * @flow 4 | */ 5 | 6 | export default class Foo { givesANum(): number { return 42; }}; 7 | -------------------------------------------------------------------------------- /tests/esproposal_class_instance_fields.warn/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | class Foo { 4 | annotationOnly: string; 5 | initOnly = 'asdf'; 6 | initWithAnnotation: string = 'asdf'; 7 | } 8 | -------------------------------------------------------------------------------- /tests/esproposal_decorators.ignore/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | class Foo { 4 | @decorator1 5 | method1() {} 6 | 7 | @decorator2 8 | @decorator3 9 | method2() {} 10 | } 11 | -------------------------------------------------------------------------------- /tests/esproposal_decorators.warn/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | class Foo { 4 | @decorator1 5 | method1() {} 6 | 7 | @decorator2 8 | @decorator3 9 | method2() {} 10 | } 11 | -------------------------------------------------------------------------------- /tests/extensions/extensions.exp: -------------------------------------------------------------------------------- 1 | 2 | foo.js:2:1,9: function call 3 | Error: 4 | foo.js:2:5,8: number 5 | This type is incompatible with 6 | bar.jsx:1:31,36: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/generators/async.js: -------------------------------------------------------------------------------- 1 | /* TODO: Support async iteration 2 | * See: https://github.com/zenparsing/async-iteration/#async-generator-functions 3 | */ 4 | async function *unsupported() {} 5 | -------------------------------------------------------------------------------- /tests/incremental_cycle/B.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var A = require ('./A'); 3 | import type * as C from './C'; 4 | 5 | class B extends A { 6 | c: C; 7 | } 8 | 9 | module.exports = B; 10 | -------------------------------------------------------------------------------- /tests/incremental_cycle/C.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var A = require ('./A'); 3 | import type * as B from './B'; 4 | 5 | class C extends A { 6 | b: B; 7 | } 8 | 9 | module.exports = C; 10 | -------------------------------------------------------------------------------- /tests/method_properties/test.js: -------------------------------------------------------------------------------- 1 | class C { 2 | C() { } 3 | foo() { } 4 | static bar() { } 5 | qux() { this.constructor.x; } 6 | } 7 | C.x; 8 | (new C).foo.x; 9 | C.bar.x; 10 | -------------------------------------------------------------------------------- /tests/nullable/simple_nullable.js: -------------------------------------------------------------------------------- 1 | function foo(x:?string) {} 2 | function bar(x:?number) {} 3 | foo('hmm'); 4 | bar('hmm'); 5 | 6 | function fn(data: ?{}) {} 7 | fn({some: 'literal'}); 8 | -------------------------------------------------------------------------------- /tests/parse_error_node/parse_error_node.exp: -------------------------------------------------------------------------------- 1 | 2 | Client.js:8:9,29: Imported.js 3 | Required module not found 4 | 5 | Imported.js:6:17,17: Unexpected token ILLEGAL 6 | 7 | Found 2 errors 8 | -------------------------------------------------------------------------------- /tests/private/private.exp: -------------------------------------------------------------------------------- 1 | 2 | private.js:11:22,28: property `_x` 3 | Error: 4 | private.js:11:27,28: property `_x` 5 | Property not found in 6 | private.js:8:7,7: B 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/type_only_vars/A.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class Foo { 6 | } 7 | 8 | class Bar { 9 | } 10 | 11 | module.exports = { 12 | Foo: Foo, 13 | Bar: Bar 14 | }; 15 | -------------------------------------------------------------------------------- /tests/undefined/undefined.exp: -------------------------------------------------------------------------------- 1 | 2 | undefined.js:3:5,11: call of method `foo` 3 | Method cannot be called on possibly undefined value 4 | undefined.js:3:5,5: undefined 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/union/issue-324.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | class Foo{}; 3 | class Bar{}; 4 | 5 | var foostr: Foo | string = new Foo(); 6 | var barstr: Bar | string = new Bar(); 7 | 8 | foostr = barstr; 9 | -------------------------------------------------------------------------------- /src/dts/tests/enums/enums.exp: -------------------------------------------------------------------------------- 1 | 2 | enums.js:8:13,19: property `R` 3 | Error: 4 | enums.js:8:13,19: number 5 | This type is incompatible with 6 | enums.js:4:8,13: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/esproposal_class_instance_fields.ignore/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | class Foo { 4 | annotationOnly: string; 5 | initOnly = 'asdf'; 6 | initWithAnnotation: string = 'asdf'; 7 | } 8 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportDefault_Class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class ClassFoo1 { 6 | returnsANumber(): number { return 42; } 7 | } 8 | 9 | export default ClassFoo1; 10 | -------------------------------------------------------------------------------- /tests/incremental_cycle/tmp1/C.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var A = require ('./A'); 3 | import type { B } from './B' 4 | 5 | class C extends A { 6 | b: B; 7 | } 8 | 9 | module.exports = C; 10 | -------------------------------------------------------------------------------- /tests/lib_interfaces/declarations/underscore.js: -------------------------------------------------------------------------------- 1 | interface C { 2 | foo(): CArrays; 3 | bar(): C; 4 | } 5 | interface CArrays extends C> { 6 | bar(): C; 7 | } 8 | -------------------------------------------------------------------------------- /tests/module_redirect/D.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule D 3 | * @flow 4 | */ 5 | 6 | var bar1: string = require('A'); 7 | var bar2: string = require('B'); 8 | var bar3: string = require('C'); 9 | -------------------------------------------------------------------------------- /tests/parse/no_parse_error.js: -------------------------------------------------------------------------------- 1 | /* 2 | @flow 3 | */ 4 | 5 | var x = 'Test'; 6 | var y = 5 / x; 7 | 8 | var z: { 9 | type: number, 10 | y: string 11 | } = {type: 1, y: 'hey'}; 12 | -------------------------------------------------------------------------------- /tests/refi/switch.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | function foo(a,b,c) { 3 | switch (c) { 4 | case a.x.y: // OK 5 | case b.x.y: // OK 6 | return; 7 | default: 8 | return; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/refinements/null.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function null_bogus_comparison() { 4 | if (100 * null) { 5 | return; 6 | } 7 | if (null * 100) { 8 | return; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/reflection/type.js: -------------------------------------------------------------------------------- 1 | declare var a: number; 2 | var b: typeof a = "..."; 3 | var c: typeof a = "..."; 4 | 5 | type T = number; 6 | var x:T = "..."; 7 | 8 | // what about recursive unions? 9 | -------------------------------------------------------------------------------- /src/common/span.mli: -------------------------------------------------------------------------------- 1 | val make_span: 2 | Loc.position -> 3 | Loc.position -> 4 | Loc.t 5 | 6 | val string_of_span: Loc.t -> string 7 | 8 | module SpanMap : Utils.MapSig with type key = Loc.t 9 | -------------------------------------------------------------------------------- /src/parser/.npmignore: -------------------------------------------------------------------------------- 1 | *.ml 2 | *.mll 3 | TARGETS 4 | Makefile 5 | _build/ 6 | facebook/ 7 | lex_test 8 | parse_test 9 | perf_test 10 | pfff_test 11 | github-README.md 12 | npm-README.md 13 | -------------------------------------------------------------------------------- /tests/async/await_not_in_async.js: -------------------------------------------------------------------------------- 1 | // note: currently, await-within-async enforcement is a 2 | // done by the parser, which bails after a single error. 3 | 4 | function f() { 5 | await 1; 6 | } 7 | -------------------------------------------------------------------------------- /tests/libconfig/libconfig.exp: -------------------------------------------------------------------------------- 1 | 2 | libtest.js:2:1,8: function call 3 | Error: 4 | libtest.js:2:5,7: number 5 | This type is incompatible with 6 | [LIB] libB.js:1:25,30: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/librec/librec.exp: -------------------------------------------------------------------------------- 1 | 2 | libtest.js:2:1,8: function call 3 | Error: 4 | libtest.js:2:5,7: number 5 | This type is incompatible with 6 | [LIB] lib/B/libB.js:1:25,30: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/more_annot/object.js: -------------------------------------------------------------------------------- 1 | var o1 = { x: 0, y: "" }; 2 | var o2 = { z: o1 } 3 | 4 | var o3 = {}; 5 | o3.w = o2; 6 | 7 | //declare var exports: { w: any }; 8 | 9 | module.exports = o3; 10 | -------------------------------------------------------------------------------- /tests/regexp/regexp.exp: -------------------------------------------------------------------------------- 1 | 2 | regexp.js:2:20,44: call of method `test` 3 | Error: 4 | regexp.js:2:20,44: boolean 5 | This type is incompatible with 6 | regexp.js:2:11,16: number 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/seal/obj_annot.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(param: { name: string; }): number { 4 | return param.id; 5 | } 6 | 7 | foo({ name: "test" }); 8 | 9 | module.exports = foo; 10 | -------------------------------------------------------------------------------- /tests/type-at-pos/test.sh: -------------------------------------------------------------------------------- 1 | FLOW=$1 2 | 3 | $FLOW type-at-pos test.js 5 1 --strip-root --json 4 | $FLOW type-at-pos test.js 5 1 --strip-root --raw 5 | $FLOW type-at-pos test.js 8 7 --strip-root --json 6 | -------------------------------------------------------------------------------- /tests/union/issue-326.js: -------------------------------------------------------------------------------- 1 | var numberAndStringArr:Array = [1,2]; 2 | var stringArr:Array = ['a','b']; 3 | 4 | var result = numberAndStringArr.concat(stringArr); // no error 5 | -------------------------------------------------------------------------------- /src/common/FlowJSON.mli: -------------------------------------------------------------------------------- 1 | open Spider_monkey_ast 2 | open Utils 3 | open Utils_js 4 | 5 | val parse_object: 6 | string -> 7 | filename -> 8 | Expression.t SMap.t * (Loc.t * Parser_flow.Error.t) list 9 | -------------------------------------------------------------------------------- /tests/config_module_name_mapper_PROJECT_ROOT/config_module_name_mapper_PROJECT_ROOT.exp: -------------------------------------------------------------------------------- 1 | 2 | main.js:6:17,20: number 3 | This type is incompatible with 4 | main.js:6:8,13: string 5 | 6 | Found 1 error 7 | -------------------------------------------------------------------------------- /tests/getters_and_setters_disabled/getters_and_setters.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | var f = { 6 | get a() { return 4; }, 7 | set b(x: number) { this.c = b; }, 8 | c: 10, 9 | }; 10 | -------------------------------------------------------------------------------- /tests/intersection/intersection.js: -------------------------------------------------------------------------------- 1 | function foo(x: $All): number { 2 | return x.type; 3 | } 4 | 5 | function bar(x: Error & {type:number}): number { 6 | return x.type; 7 | } 8 | -------------------------------------------------------------------------------- /tests/liberr/libs/parse_error.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | declare class ExampleClass { 5 | 6 | methodA: () => any // parse error, missing comma 7 | 8 | methodB: () => any 9 | 10 | } 11 | -------------------------------------------------------------------------------- /tests/object_is/object_is.exp: -------------------------------------------------------------------------------- 1 | 2 | object_is.js:20:17,35: Object.is 3 | Error: 4 | object_is.js:20:17,35: boolean 5 | This type is incompatible with 6 | object_is.js:20:8,13: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/optional/optional_param2.js: -------------------------------------------------------------------------------- 1 | declare class I { 2 | map( 3 | mapper: (value?: V) => M 4 | ): I; 5 | } 6 | var i:I = new I(); 7 | var j:I = i.map(id => id); 8 | -------------------------------------------------------------------------------- /tests/statics/class_statics.js: -------------------------------------------------------------------------------- 1 | class C { 2 | static f(x:number) { } 3 | static x:string; 4 | } 5 | 6 | C.g = function(x:string) { C.f(x); }; 7 | C.g(0); 8 | 9 | var x:number = C.x; 10 | C.x = 0; -------------------------------------------------------------------------------- /src/dts/tests/modules2/modules2.exp: -------------------------------------------------------------------------------- 1 | 2 | modules2.js:5:22,24: property `y` 3 | Error: 4 | modules2.js:6:18,18: number 5 | This type is incompatible with 6 | modules2.js:6:9,14: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/async/await_not_in_async2.js: -------------------------------------------------------------------------------- 1 | // note: currently, await-within-async enforcement is a 2 | // done by the parser, which bails after a single error. 3 | 4 | function f(x) { return x; } 5 | 6 | f(await 1); 7 | -------------------------------------------------------------------------------- /tests/callable/primitives.js: -------------------------------------------------------------------------------- 1 | var x = Boolean(4); 2 | function foo(fn:(value:any)=>boolean) { } 3 | foo(Boolean); 4 | 5 | var dict: { [k: string]: any } = {}; 6 | dict(); // error, callable signature not found 7 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/subdir/custom_resolve_dir/testproj2/index.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | export var name: "subdir/custom_resolve_dir/testproj2" = "subdir/custom_resolve_dir/testproj2"; 4 | -------------------------------------------------------------------------------- /tests/declare_class/lib/test.js: -------------------------------------------------------------------------------- 1 | declare class _C { 2 | foo(): number; 3 | } 4 | declare var _module: { 5 | C: Class<_C>; 6 | } 7 | declare class D extends _module.C { 8 | foo(): string; 9 | } 10 | -------------------------------------------------------------------------------- /tests/esproposal_class_static_fields.ignore/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | class Foo { 4 | static annotationOnly: string; 5 | static initOnly = 'asdf'; 6 | static initWithAnnotation: string = 'asdf'; 7 | } 8 | -------------------------------------------------------------------------------- /tests/esproposal_class_static_fields.warn/test.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | class Foo { 4 | static annotationOnly: string; 5 | static initOnly = 'asdf'; 6 | static initWithAnnotation: string = 'asdf'; 7 | } 8 | -------------------------------------------------------------------------------- /tests/immutable_methods/immutable_methods.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:9:1,5: assignment of property `foo` 3 | Error: 4 | test.js:9:3,5: property `foo` 5 | Property not found in 6 | test.js:9:1,1: A 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/lib/libtest.js: -------------------------------------------------------------------------------- 1 | var x:string = NaN 2 | var y:string = Number.MAX_VALUE; 3 | var z:number = new TypeError().name; 4 | var w:string = parseInt("..."); 5 | 6 | var a = new Map(); 7 | a.delete('foobar'); 8 | -------------------------------------------------------------------------------- /tests/misc/E.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule E */ 3 | 4 | function h(x:number) { } 5 | var proto = { fn: h } 6 | 7 | var o = Object.create(proto); 8 | o.fn(false); 9 | 10 | module.exports = {obj: o}; 11 | -------------------------------------------------------------------------------- /tests/overload/test2.js: -------------------------------------------------------------------------------- 1 | declare class Foo { 2 | bar(x: 'hmm'): number; 3 | bar(x: string): string; 4 | } 5 | var foo = new Foo; 6 | (foo.bar('hmm'): number); // OK 7 | (foo.bar('hmmm'): number); // error 8 | -------------------------------------------------------------------------------- /src/dts/tests/enums/declarations/enums.js.exp: -------------------------------------------------------------------------------- 1 | // This was originally an Enum. See line 1 in .d.ts file. 2 | declare class Color { 3 | static R : number; 4 | static G : number; 5 | static B : number; 6 | } 7 | -------------------------------------------------------------------------------- /src/dts/tests/modules2/declarations/modules2.js.exp: -------------------------------------------------------------------------------- 1 | // Module declared on line 1 in .d.ts file 2 | declare module "M.N" { 3 | declare var x: number; 4 | declare class C { 5 | y: typeof x; 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/dts/tests/type_alias/declarations/type_alias.js.exp: -------------------------------------------------------------------------------- 1 | // Module declared on line 1 in .d.ts file 2 | declare module "M" { 3 | declare type NumString = number | string; 4 | declare var x: NumString; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /tests/docblock/docblock.exp: -------------------------------------------------------------------------------- 1 | 2 | docblock.js:34:1,3: assignment of property `o` 3 | Error: 4 | docblock.js:34:3,3: property `o` 5 | Property not found in 6 | docblock.js:18:7,7: statics of C 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/iterable/string.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var stringTest1: Iterable = "hi"; 4 | var stringTest3: Iterable<*> = "hi"; 5 | var stringTest3: Iterable = "hi"; // Error - string is a Iterable 6 | -------------------------------------------------------------------------------- /tests/more_classes/Qux.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule Qux */ 3 | 4 | class Qux { 5 | w:number; 6 | 7 | qux() { return this.w; } 8 | 9 | fooqux(x:number) { } 10 | } 11 | 12 | module.exports = Qux; 13 | -------------------------------------------------------------------------------- /tests/simple_arrays/array.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | var a = []; 3 | for (var i = 0; i < 10; ++i) { 4 | if (i % 2 == 0) { a[i] = 0; } 5 | else { a[i] = ''; }; 6 | } 7 | 8 | function foo(i): string { return a[i]; } 9 | -------------------------------------------------------------------------------- /tests/strict/obj.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | // progressively annotate: 6 | 7 | var o = { x: 0 } 8 | //var o: {x: number;} = { x: 0 } 9 | 10 | var x:string = o.x; 11 | 12 | module.exports = o; 13 | -------------------------------------------------------------------------------- /tests/taint/taint2.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @flow 4 | */ 5 | class A { 6 | f(tainted : $Tainted) { 7 | // This *should* give a warning. 8 | document.location.assign(tainted); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/dts/tests/modules/modules.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var M = require('M');; 3 | 4 | var x : M.C = new M.C(); 5 | var z : typeof M.x = x.y; 6 | var m : string = z; 7 | var obj = new I(); 8 | var ret: string = obj.get_y(x); 9 | -------------------------------------------------------------------------------- /tests/async/await_not_in_async3.js: -------------------------------------------------------------------------------- 1 | // note: currently, await-within-async enforcement is a 2 | // done by the parser, which bails after a single error. 3 | 4 | async function f(x) { return x; } 5 | 6 | f(await 1); 7 | -------------------------------------------------------------------------------- /tests/config_module_name_rewrite_haste/config_module_name_rewrite_haste.exp: -------------------------------------------------------------------------------- 1 | 2 | A.js:12:10,32: Exists3 3 | Required module not found 4 | 5 | A.js:13:22,35: Exists4 6 | Required module not found 7 | 8 | Found 2 errors 9 | -------------------------------------------------------------------------------- /tests/name_prop/function.js: -------------------------------------------------------------------------------- 1 | /* TODO - we currently say that a function's statics are an AnyObjT and 2 | * anything goes. When we start enforcing the statics properly, we'll need to 3 | * know that .name exists 4 | */ 5 | -------------------------------------------------------------------------------- /tests/strict/annot.js: -------------------------------------------------------------------------------- 1 | var A = require('./unknown_class'); 2 | 3 | class B extends A { 4 | foo(x:A):A { return x; } 5 | bar(x) { } 6 | qux(x:X,y:Y):X { return x;} 7 | } 8 | 9 | module.exports = B; 10 | -------------------------------------------------------------------------------- /tests/tuples/tuples.js: -------------------------------------------------------------------------------- 1 | var a: [] = []; 2 | var b: [] = [123]; 3 | var c: [number] = []; 4 | var d: [number, string] = [123,'duck']; 5 | var e: [number, string,] = [123,'duck']; 6 | var f: [number, string] = [123, 456]; 7 | -------------------------------------------------------------------------------- /tests/union/fields2.js: -------------------------------------------------------------------------------- 1 | class C { } 2 | 3 | class D { 4 | content: string|C; 5 | copyContent(content: C): string|C { 6 | this.content = content; 7 | return this.content; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/dts/tests/interface_var/declarations/interface_var.d.ts: -------------------------------------------------------------------------------- 1 | interface adult { 2 | height: number; 3 | age: number; 4 | } 5 | 6 | declare var adult: { 7 | minage: number; 8 | new(): adult; 9 | } 10 | -------------------------------------------------------------------------------- /src/dts/tests/var_interface/declarations/var_interface.d.ts: -------------------------------------------------------------------------------- 1 | declare var adult: { 2 | minage: number; 3 | new(): adult; 4 | } 5 | 6 | interface adult { 7 | height: number; 8 | age: number; 9 | } 10 | -------------------------------------------------------------------------------- /tests/plsummit/locals.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo() { 4 | var x = 0; 5 | var y = x; 6 | } 7 | 8 | function bar(x: ?string): number { 9 | if (x == null) x = ""; 10 | return x.length; 11 | } 12 | -------------------------------------------------------------------------------- /tests/refinements/ast_node.js: -------------------------------------------------------------------------------- 1 | type Node1 = { 2 | kind: 'Node1', 3 | prop1?: string 4 | }; 5 | 6 | type Node2 = { 7 | kind: 'Node2', 8 | prop2?: string 9 | } 10 | 11 | export type ASTNode = Node1 | Node2; 12 | -------------------------------------------------------------------------------- /tests/suggest/suggest.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var bar = require('./lib'); 4 | 5 | function foo(z: number) { return bar(z); } 6 | 7 | var array = ["foo", "bar"]; 8 | array; 9 | 10 | module.exports = {foo:foo}; 11 | -------------------------------------------------------------------------------- /tests/suppress/suppress.exp: -------------------------------------------------------------------------------- 1 | 2 | A.js:14:1,38: Error suppressing comment 3 | Unused suppression 4 | 5 | A.js:16:21,23: number 6 | This type is incompatible with 7 | A.js:16:12,17: string 8 | 9 | Found 2 errors 10 | -------------------------------------------------------------------------------- /tests/any/any.js: -------------------------------------------------------------------------------- 1 | function foo(x:any):any { return x; } 2 | function bar(x:any):mixed { return x; } 3 | function qux(x:mixed):any { return x; } 4 | 5 | var x:string = foo(0); 6 | var y:string = bar(0); 7 | var z:string = qux(0); 8 | -------------------------------------------------------------------------------- /tests/array_spread/test.js: -------------------------------------------------------------------------------- 1 | var A = [1,2,3]; 2 | var B = [...A]; 3 | var C = [1,2,3]; 4 | B.sort((a, b) => a - b); 5 | C.sort((a, b) => a - b); 6 | 7 | var x: Array = ['1', '2']; 8 | var y: Array = ['3', ...x]; 9 | -------------------------------------------------------------------------------- /tests/config_file_extensions/config_file_extensions.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js.es6:9:1,20: function call 3 | Error: 4 | test.js.es6:6:10,10: string 5 | This type is incompatible with 6 | test.js.es6:6:10,15: number 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/import_type/ExportNamed_Class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class ClassFoo2 { 6 | returnsANumber(): number { return 42; } 7 | } 8 | 9 | export {ClassFoo2}; 10 | export var foo2Inst = new ClassFoo2(); 11 | -------------------------------------------------------------------------------- /tests/more_path/FlowSA.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule FlowSA */ 3 | 4 | function check(x:string) { } 5 | 6 | function FlowSA() { 7 | var x = 0; 8 | x = "..."; 9 | check(x); 10 | } 11 | 12 | module.exports = FlowSA; 13 | -------------------------------------------------------------------------------- /examples/03_Null/answer/nulls.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function length(x) { 4 | if (x != null) { 5 | return x.length; 6 | } else { 7 | return 0; 8 | } 9 | } 10 | 11 | var total = length("Hello") + length(null); 12 | -------------------------------------------------------------------------------- /src/dts/tests/enums/enums.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | var x = Color.R; 3 | 4 | var y: string = ""; 5 | 6 | switch (x) { 7 | case Color.B: 8 | y = Color.R; 9 | case Color.R: 10 | y = "this is a string"; 11 | } 12 | -------------------------------------------------------------------------------- /tests/equals/equals.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | (1 == 1); 4 | ("foo" == "bar"); 5 | (1 == null); 6 | (null == 1); 7 | (1 == ""); // error 8 | ("" == 1); // error 9 | 10 | var x = (null : ?number); 11 | (x == 1); 12 | (1 == x); 13 | -------------------------------------------------------------------------------- /tests/getters_and_setters_enabled/react.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | React.createClass({ 6 | propTypes: { 7 | get a() { return 4; }, 8 | set b(x: number) { this.c = x; }, 9 | c: 10, 10 | } 11 | }); 12 | -------------------------------------------------------------------------------- /tests/import_type/ExportDefault_Class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class ClassFoo1 { 6 | returnsANumber(): number { return 42; } 7 | } 8 | 9 | export default ClassFoo1; 10 | export var foo1Inst = new ClassFoo1(); 11 | -------------------------------------------------------------------------------- /tests/suppress/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | lib.js 7 | 8 | [options] 9 | suppress_comment=.*\\$FlowFixMe 10 | suppress_comment=.*\\$FlowIssue 11 | suppress_comment=\\(.\\|\n\\)*\\$FlowNewLine 12 | -------------------------------------------------------------------------------- /examples/02_TypeAnnotations/answer/type_annotations.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | // Changing the return type to number fixes the error 4 | function foo(x: string, y: number): number { 5 | return x.length * y; 6 | } 7 | 8 | foo("Hello", 42); 9 | -------------------------------------------------------------------------------- /src/dts/tests/export_modules/export_modules.exp: -------------------------------------------------------------------------------- 1 | 2 | export_modules.js:3:19,30: property `y` 3 | Error: 4 | export_modules.js:3:19,30: number 5 | This type is incompatible with 6 | export_modules.js:3:9,14: string 7 | 8 | Found 1 error 9 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/toplevel.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import {name} from "testproj"; 4 | 5 | (name: "node_modules/testproj"); 6 | (name: "custom_resolve_dir/testproj"); // Error: Resolve from node_modules first! 7 | -------------------------------------------------------------------------------- /tests/find-module/find-module.exp: -------------------------------------------------------------------------------- 1 | {"file":"req.js"} 2 | {"path":"test.js","line":1,"endline":1,"start":5,"end":5} 3 | {"path":"req.js","line":0,"endline":0,"start":1,"end":0} 4 | {"path":"req.js","line":0,"endline":0,"start":1,"end":0} 5 | -------------------------------------------------------------------------------- /tests/mixins/mixins.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:5:21,26: number 3 | This type is incompatible with 4 | test.js:5:12,17: string 5 | 6 | test.js:6:10,10: property `y` 7 | Property not found in 8 | test.js:3:7,9: Foo 9 | 10 | Found 2 errors 11 | -------------------------------------------------------------------------------- /tests/undefined/undefined.js: -------------------------------------------------------------------------------- 1 | function foo() { 2 | var x; 3 | x.foo(); 4 | } 5 | 6 | function bar() { 7 | var x:?{ bar():void; }; 8 | if (x) x.bar(); 9 | } 10 | 11 | function qux(x?: number, y:string = "", z) { } 12 | -------------------------------------------------------------------------------- /tests/unreachable/unreachable.exp: -------------------------------------------------------------------------------- 1 | 2 | unreachable.js:13:13,15:3: 3 | unreachable code 4 | 5 | unreachable.js:22:11,11: 6 | unreachable code 7 | 8 | unreachable.js:24:11,11: 9 | unreachable code 10 | 11 | Found 3 errors 12 | -------------------------------------------------------------------------------- /examples/05_DynamicCode/answer/dynamic.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(x) { 4 | if (typeof x === 'string') { 5 | return x.length; 6 | } else { 7 | return x; 8 | } 9 | } 10 | 11 | var res = foo("Hello") + foo(42); 12 | -------------------------------------------------------------------------------- /tests/get-def/library.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | module.exports = { 4 | 5 | iTakeAString: function(name: string): number { 6 | return 42; 7 | }, 8 | 9 | bar: function(): number { 10 | return 42; 11 | }, 12 | 13 | }; 14 | -------------------------------------------------------------------------------- /tests/misc/C.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule C */ 3 | 4 | var B = require('B'); 5 | var f = require('A').fn; 6 | 7 | function C() { 8 | var o = new B(); 9 | f(o.b); 10 | f(o.s); 11 | o.fn(); 12 | } 13 | 14 | module.exports = C; 15 | -------------------------------------------------------------------------------- /tests/react/import_react.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | import react from "react"; 4 | import {Component} from "react"; 5 | 6 | var a: Component = new react.Component(); 7 | var b: number = new react.Component(); // Error: ReactComponent ~> number 8 | -------------------------------------------------------------------------------- /tests/symlink/symlink.exp: -------------------------------------------------------------------------------- 1 | 2 | foo.js:1:16,21: number 3 | This type is incompatible with 4 | qux.js:2:7,8: string 5 | 6 | qux.js:2:7,8: string 7 | This type is incompatible with 8 | foo.js:1:16,21: number 9 | 10 | Found 2 errors 11 | -------------------------------------------------------------------------------- /tests/taint/taint1.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @flow 4 | */ 5 | class A { 6 | f(tainted : $Tainted) { 7 | // This shouldn't give a warning (both are tainted) 8 | var also_tainted : $Tainted = tainted; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/declare_type/lib/DeclareModule_TypeAlias.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | declare module ModuleAliasFoo { 6 | declare type baz = number; 7 | declare type toz = string; 8 | declare function foo(bar : baz) : toz; 9 | } 10 | -------------------------------------------------------------------------------- /tests/destructuring/destructuring_param.js: -------------------------------------------------------------------------------- 1 | function f(a, { b }) { 2 | return a + b; 3 | } 4 | 5 | function g(a, { a }) { 6 | return a; 7 | } 8 | 9 | function h({ a, { b } }, { c }, { { d } }) { 10 | return a + b + c + d; 11 | } 12 | -------------------------------------------------------------------------------- /tests/find-module/test.sh: -------------------------------------------------------------------------------- 1 | FLOW=$1 2 | 3 | $FLOW find-module --strip-root --json ./req test.js 4 | $FLOW get-def --strip-root --json test.js 2 2 5 | $FLOW get-def --strip-root --json test.js 1 10 6 | $FLOW get-def --strip-root --json test.js 4 18 7 | -------------------------------------------------------------------------------- /tests/iterable/iter.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(strs: Iterable): void { 4 | for (var s: string of strs) { 5 | console.log(s); 6 | } 7 | } 8 | 9 | var m: Map = new Map(); 10 | 11 | foo(m.keys()); 12 | -------------------------------------------------------------------------------- /tests/modules/lib.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function g(x:string) { } 4 | 5 | //function f(x) { g(x); return x; } 6 | //function f(x:number) { g(x); return x; } 7 | function f(x:number):number { g(x); return x; } 8 | 9 | module.exports = f; 10 | -------------------------------------------------------------------------------- /tests/more_statics/class_static.js: -------------------------------------------------------------------------------- 1 | class B { 2 | static foo(): string { return ""; } 3 | } 4 | 5 | class C extends B { 6 | static bar(): string { return ""; } 7 | } 8 | 9 | var x: number = C.bar(); 10 | var y: number = C.foo(); 11 | -------------------------------------------------------------------------------- /tests/value/value.exp: -------------------------------------------------------------------------------- 1 | 2 | value.js:3:16,21: number 3 | This type is incompatible with 4 | value.js:3:7,12: string 5 | 6 | value.js:6:14,20: string 7 | This type is incompatible with 8 | value.js:5:27,32: number 9 | 10 | Found 2 errors 11 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you have any questions, please drop us a line at cla@fb.com. Thanks! 2 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportFrom_Intermediary1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportFrom_Intermediary1 3 | * @flow 4 | */ 5 | 6 | export { 7 | numberValue1, 8 | numberValue2 as numberValue2_renamed 9 | } from "ES6_ExportFrom_Source1"; 10 | -------------------------------------------------------------------------------- /tests/es6modules/ES6_ExportFrom_Intermediary2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule ES6_ExportFrom_Intermediary2 3 | * @flow 4 | */ 5 | 6 | export { 7 | numberValue1, 8 | numberValue2 as numberValue2_renamed2 9 | } from "ES6_ExportFrom_Source2"; 10 | -------------------------------------------------------------------------------- /tests/getters_and_setters_disabled/getters_and_setters_disabled.exp: -------------------------------------------------------------------------------- 1 | 2 | getters_and_setters.js:6:3,23: 3 | get/set properties not yet supported 4 | 5 | getters_and_setters.js:7:3,34: 6 | get/set properties not yet supported 7 | 8 | Found 2 errors 9 | -------------------------------------------------------------------------------- /tests/immutable_methods/test.js: -------------------------------------------------------------------------------- 1 | class A { 2 | foo(): A { return this; } 3 | } 4 | class B extends A { 5 | foo(): B { return this; } 6 | } 7 | class C extends A {} 8 | var a: A = new B(); 9 | a.foo = function(): C { return new C(); } 10 | -------------------------------------------------------------------------------- /tests/sealed/function.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function Bar(x: number) { 4 | this.x = x; 5 | } 6 | Bar.prototype.getX = function() { return this.x; } 7 | Bar.prototype.getY = function(): string { return this.y; } 8 | 9 | module.exports = Bar; 10 | -------------------------------------------------------------------------------- /src/dts/tests/modules/declarations/modules.d.ts: -------------------------------------------------------------------------------- 1 | declare module M { 2 | export var x: number 3 | export class C { 4 | y : typeof x 5 | } 6 | } 7 | 8 | interface I { 9 | x : typeof M.x 10 | get_y(c: M.C): typeof M.x 11 | } 12 | -------------------------------------------------------------------------------- /tests/class_type/test.js: -------------------------------------------------------------------------------- 1 | class A { } 2 | function foo(x: Class): A { 3 | return new x(); // OK 4 | } 5 | 6 | class B { 7 | constructor(_: any) { } 8 | } 9 | function bar(x: Class): B { 10 | return new x(); // error (too few args) 11 | } 12 | -------------------------------------------------------------------------------- /tests/es6modules/ProvidesModuleA.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule A 3 | * @flow 4 | */ 5 | 6 | exports.numberValue1 = 42; 7 | exports.numberValue2 = 42; 8 | exports.numberValue3 = 42; 9 | exports.numberValue4 = 42; 10 | exports.stringValue = "str"; 11 | -------------------------------------------------------------------------------- /tests/issues-11/issues-11.exp: -------------------------------------------------------------------------------- 1 | 2 | import.js:3:17,19: number 3 | This type is incompatible with 4 | import.js:3:8,13: string 5 | 6 | import.js:4:17,19: string 7 | This type is incompatible with 8 | import.js:4:8,13: number 9 | 10 | Found 2 errors 11 | -------------------------------------------------------------------------------- /tests/while/test.js: -------------------------------------------------------------------------------- 1 | class C { 2 | m() { return new C; } 3 | } 4 | function blah() {} 5 | var node: ?C = new C; 6 | while (node) { 7 | var parent = node.m(); 8 | var cloneable: C = node; 9 | blah(); 10 | node = parent.m(); 11 | } 12 | -------------------------------------------------------------------------------- /hack/third-party/core/poly.ml: -------------------------------------------------------------------------------- 1 | (** [Poly] is a convenient shorthand for [Polymorphic_compare] in the common case that one 2 | wants to use a polymorphic comparator directly in an expression, e.g. [Poly.equal a 3 | b]. *) 4 | 5 | include Polymorphic_compare 6 | -------------------------------------------------------------------------------- /tests/config_file_extensions/test.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @flow 3 | */ 4 | 5 | function foo(x) { 6 | var a: number = 'asdf'; 7 | return x * 10; 8 | } 9 | 10 | // This file should be ignored, so this should not result in an error 11 | foo('Hello, world!'); 12 | -------------------------------------------------------------------------------- /tests/es6modules/CommonJS_Named.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule CommonJS_Named 3 | * @flow 4 | */ 5 | 6 | exports.numberValue1 = 1; 7 | exports.numberValue2 = 2; 8 | exports.numberValue3 = 3; 9 | exports.numberValue4 = 4; 10 | exports.numberValue5 = 5; 11 | -------------------------------------------------------------------------------- /tests/object_annot/test.js: -------------------------------------------------------------------------------- 1 | function foo(x: Array): Array { 2 | return x.sort((a, b) => a.foo - b.foo); 3 | } 4 | 5 | // Make sure Object works with Object.keys() 6 | function bar(x: Object): Array { 7 | return Object.keys(x); 8 | } 9 | -------------------------------------------------------------------------------- /tests/config_module_system_node_resolve_dirname/subdir/sublevel.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | import {name} from "testproj2"; 4 | 5 | (name: "node_modules/testproj2"); // Error: Resolve from sibling 'custom_resolve_dir' first! 6 | (name: "subdir/custom_resolve_dir/testproj2"); 7 | -------------------------------------------------------------------------------- /tests/import_type/ExportNamed_Alias.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | export type AliasFoo3 = { 6 | givesANum(): number 7 | }; 8 | export function givesAFoo3Obj(): AliasFoo3 { 9 | return { 10 | givesANum(): number { return 42; } 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /tests/misc/D.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule D */ 3 | 4 | var f = require('A').fn; 5 | 6 | function g():string { return this.i; } 7 | 8 | var o = {fn: g, ...{}}; 9 | o.i = true; 10 | 11 | var i = o.fn(); 12 | f(i); 13 | 14 | module.exports = "D for dummy"; 15 | -------------------------------------------------------------------------------- /tests/object_api/object_assign.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var export_ = Object.assign({}, { 4 | foo: function(param) { return param; } 5 | }); 6 | 7 | var decl_export_: { foo: any; bar: any } = Object.assign({}, export_); 8 | 9 | module.exports = export_; 10 | -------------------------------------------------------------------------------- /examples/04_Arrays/arrays.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function total(numbers: Array) { 4 | var result = 0; 5 | for (var i = 0; i < numbers.length; i++) { 6 | result += numbers[i]; 7 | } 8 | return result; 9 | } 10 | 11 | total([1, 2, 3, "Hello"]); 12 | -------------------------------------------------------------------------------- /tests/builtins/genericfoo.js: -------------------------------------------------------------------------------- 1 | class Foo { 2 | x:T; 3 | self():Foo { return this; } 4 | map(callbackfn: () => U): Foo { return new Foo(); } 5 | set(x:T): void { } 6 | get(): T { return this.x; } 7 | } 8 | 9 | module.exports = Foo; 10 | -------------------------------------------------------------------------------- /tests/declare_fun/test.js: -------------------------------------------------------------------------------- 1 | declare function foo(x: number): string; 2 | declare function foo(x: string): number; 3 | declare function foo(x: X): X; 4 | 5 | (foo(0): string); // OK 6 | (foo("hello"): number); // OK 7 | (foo(false): void); // error, boolean ~/~ undefined 8 | -------------------------------------------------------------------------------- /tests/export_default/test.js: -------------------------------------------------------------------------------- 1 | var M = require('M'); 2 | var N = require('N'); 3 | N.x = M(N.x); 4 | var P = require('./P'); // implementation of P redirects to module M 5 | N.y = P(N.y); 6 | var Q = require('Q'); // declaration of Q redirects to module M 7 | N.z = Q(N.z); 8 | -------------------------------------------------------------------------------- /tests/import_type/ExportCJSDefault_Class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class ClassFoo3 { 6 | givesANum(): number { return 42; } 7 | static givesAFoo3(): ClassFoo3 { 8 | return new ClassFoo3(); 9 | } 10 | } 11 | 12 | module.exports = ClassFoo3; 13 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportCJSDefault_Class.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | class ClassFoo3 { 6 | givesANum(): number { return 42; } 7 | static givesAFoo3(): ClassFoo3 { 8 | return new ClassFoo3(); 9 | } 10 | } 11 | 12 | module.exports = ClassFoo3; 13 | -------------------------------------------------------------------------------- /tests/import_typeof/ExportNamed_Alias.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | export type AliasFoo3 = { 6 | givesANum(): number 7 | }; 8 | export function givesAFoo3Obj(): AliasFoo3 { 9 | return { 10 | givesANum(): number { return 42; } 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /tests/loners/loners.js: -------------------------------------------------------------------------------- 1 | var o = { x: 5, y: "jello" }; 2 | var z = o.z; 3 | var export_o: { x: number; } = o; 4 | 5 | function f(u,v?):number { return u; } 6 | var export_f: (u: number) => number = f; 7 | 8 | //exports = export_o; 9 | module.exports = export_f; 10 | -------------------------------------------------------------------------------- /examples/04_Arrays/answer/arrays.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function total(numbers: Array) { 4 | var result = 0; 5 | for (var i = 0; i < numbers.length; i++) { 6 | result += numbers[i]; 7 | } 8 | return result; 9 | } 10 | 11 | total([1, 2, 3, 4]); 12 | -------------------------------------------------------------------------------- /tests/class_subtyping/test4.js: -------------------------------------------------------------------------------- 1 | class C { x: X; } 2 | 3 | function foo(c: C, x: X) { } 4 | 5 | type O = { f: number }; 6 | 7 | foo((new C: C), { f_: 0 }); 8 | 9 | class D extends C { 10 | bar() { this.x; } 11 | } 12 | 13 | foo(new D, { f_: 0 }); 14 | -------------------------------------------------------------------------------- /tests/declare_type/declare_type.exp: -------------------------------------------------------------------------------- 1 | 2 | import_declare_type.js:11:15,20: string 3 | This type is incompatible with 4 | import_declare_type.js:11:9,11: number 5 | 6 | import_declare_type.js:12:9,11: identifier `toz` 7 | Could not resolve name 8 | 9 | Found 2 errors 10 | -------------------------------------------------------------------------------- /tests/es6modules/CommonJS_Clobbering_Lit.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule CommonJS_Clobbering_Lit 3 | * @flow 4 | */ 5 | 6 | module.exports = { 7 | numberValue1: 1, 8 | numberValue2: 2, 9 | numberValue3: 3, 10 | numberValue4: 4, 11 | numberValue5: 5 12 | }; 13 | -------------------------------------------------------------------------------- /tests/misc/B.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule B */ 3 | 4 | var A = require('A').cls; 5 | 6 | function B() { 7 | this.b = "..."; 8 | } 9 | 10 | function f():number { return this.b; } 11 | 12 | B.prototype.s = 0; 13 | B.prototype.fn = f; 14 | 15 | module.exports = B; 16 | -------------------------------------------------------------------------------- /tests/optional/optional.js: -------------------------------------------------------------------------------- 1 | function bar(x?,y?) { x * 0; } 2 | bar(0); 3 | 4 | var foo:(x?:number)=>void = bar; 5 | foo(); 6 | 7 | function qux(x="hello",...y):string { foo(x); return y[0]; } 8 | 9 | qux(0,0); 10 | qux(0,...["",42]); 11 | 12 | module.exports = qux; 13 | -------------------------------------------------------------------------------- /tests/strict/fun.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | // progressively annotate: 6 | 7 | //function f(x) { return x; } 8 | function f(x:number) { return x; } 9 | //function f(x:number):string { return x; } 10 | 11 | var x:string = f(0); 12 | 13 | module.exports = f; 14 | -------------------------------------------------------------------------------- /tests/super/super.js: -------------------------------------------------------------------------------- 1 | 2 | class A { 3 | constructor(x:number) { } 4 | f(x:string) { } 5 | } 6 | 7 | class B extends A { 8 | constructor(x:string,y:number) { 9 | super(x); 10 | } 11 | g() { 12 | super.f(0); 13 | return super.g; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/taint/taint4.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @flow 4 | */ 5 | 6 | var safe : string = "safe"; 7 | // This should be allowed. 8 | var tainted : $Tainted = safe 9 | 10 | function f(x : $Tainted) { 11 | // Should cause error. 12 | var y : any = x; 13 | } 14 | -------------------------------------------------------------------------------- /tests/arrows/advanced_arrows.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | var add = (x: number, y: number): number => x + y; 6 | 7 | var bad = (x: number): string => x; // Error! 8 | 9 | var ident = (x: T): T => x; 10 | (ident(1): number); 11 | (ident("hi"): number); // Error 12 | -------------------------------------------------------------------------------- /tests/autocomplete/autocomplete.exp: -------------------------------------------------------------------------------- 1 | num number 2 | str string 3 | [{"name":"num","type":"number","func_details":null,"path":"foo.js","line":6,"endline":6,"start":8,"end":10},{"name":"str","type":"string","func_details":null,"path":"foo.js","line":7,"endline":7,"start":8,"end":14}] 4 | -------------------------------------------------------------------------------- /tests/taint/taint3.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * @flow 4 | */ 5 | class A { 6 | f(tainted : $Tainted) { 7 | // The Tainted annotation should still flow. 8 | var safe = tainted; 9 | // This should give a warning. 10 | var loc : string = safe; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/conditional/conditional.exp: -------------------------------------------------------------------------------- 1 | 2 | conditional.js:23:24,24: number 3 | This type is incompatible with 4 | conditional.js:20:15,20: string 5 | 6 | conditional.js:23:29,37: boolean 7 | This type is incompatible with 8 | conditional.js:20:15,20: string 9 | 10 | Found 2 errors 11 | -------------------------------------------------------------------------------- /tests/type_only_vars/type_alias.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @flow 3 | */ 4 | 5 | type Foo = number; 6 | 7 | // You can't use it as an identifier 8 | var x = Foo; 9 | 10 | // But using it in a type should still work 11 | var a: Foo = 123; 12 | var b: Array = [123]; 13 | type c = Foo; 14 | -------------------------------------------------------------------------------- /tests/union/issue-256.js: -------------------------------------------------------------------------------- 1 | declare class Myclass { 2 | myfun(myarray: Array): any; 3 | } 4 | declare var myclass: Myclass; 5 | 6 | myclass.myfun(["1", "2", "3", "4", "5", "6", function (ar) {}]) 7 | myclass.myfun(["1", "2", "3", "4", "5", "6", "7", function (ar) {}]) 8 | -------------------------------------------------------------------------------- /tests/interface/test3.js: -------------------------------------------------------------------------------- 1 | interface I { x: number, y : string } 2 | interface J { y : number } 3 | interface K extends I, J { x: string } // error: x is number in I 4 | function foo(k: K) { 5 | (k.x: number); // error: x is string in K 6 | (k.y: number); // error: y is string in I 7 | } 8 | -------------------------------------------------------------------------------- /tests/intersection/intersection.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:5:39,42: intersection type 3 | This type is incompatible with 4 | test.js:5:12,35: object type 5 | 6 | test.js:9:43,46: intersection type 7 | This type is incompatible with 8 | test.js:9:12,39: function type 9 | 10 | Found 2 errors 11 | -------------------------------------------------------------------------------- /tests/more_statics/more_statics.exp: -------------------------------------------------------------------------------- 1 | 2 | class_static.js:9:17,23: string 3 | This type is incompatible with 4 | class_static.js:9:8,13: number 5 | 6 | class_static.js:10:17,23: string 7 | This type is incompatible with 8 | class_static.js:10:8,13: number 9 | 10 | Found 2 errors 11 | -------------------------------------------------------------------------------- /tests/weakmode/should_fail_without_weak.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | // This should fail without weak mode, because of the glaring type error. 3 | 4 | function returns_a_string() { 5 | return "Hello"; 6 | } 7 | 8 | function expects_an_int() { 9 | return returns_a_string() * 10; 10 | } 11 | -------------------------------------------------------------------------------- /tests/weakmode/should_pass_with_weak.js: -------------------------------------------------------------------------------- 1 | /* @flow weak */ 2 | // This should fail without weak mode, because of the glaring type error. 3 | 4 | function returns_a_string() { 5 | return "Hello"; 6 | } 7 | 8 | function expects_an_int() { 9 | return returns_a_string() * 10; 10 | } 11 | -------------------------------------------------------------------------------- /tests/misc/A.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule A */ 3 | 4 | module.exports = {}; 5 | 6 | var A = {x:true, ...{}}; 7 | module.exports.cls = A; 8 | 9 | function f(x:boolean) { } 10 | module.exports.fn = f; 11 | 12 | A.y = "?"; 13 | A.x = A.y; 14 | f(A.x); // A.x is now a string, by def assign 15 | -------------------------------------------------------------------------------- /tests/taint/globals.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | class A { 4 | f(x : $Tainted) { 5 | // Should be an error. 6 | document.location = x; 7 | } 8 | f1(x : $Tainted) { 9 | // TODO(rcastano): should cause an error. 10 | window.location = x; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/builtin_uses/builtin_uses.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:1:9,33: Object.freeze 3 | Error: 4 | test.js:2:2,6: number 5 | This type is incompatible with 6 | test.js:2:9,14: string 7 | 8 | test2.js:2:2,6: number 9 | This type is incompatible with 10 | test2.js:2:9,14: string 11 | 12 | Found 2 errors 13 | -------------------------------------------------------------------------------- /tests/class_subtyping/test3.js: -------------------------------------------------------------------------------- 1 | class A {} 2 | class B extends A {} 3 | class C extends B {} 4 | 5 | var c: C> = new C; // none of the type args matter 6 | var a: A> = c; // the third type arg is incorrect 7 | -------------------------------------------------------------------------------- /tests/more_react/JSX.js: -------------------------------------------------------------------------------- 1 | 2 | /* @providesModule JSX */ 3 | 4 | var React = require('react'); 5 | var App = require('App.react'); 6 | 7 | var app = 8 | // error, y: number but foo expects string in App.react 9 | Some text. 10 | ; 11 | 12 | module.exports = app; 13 | -------------------------------------------------------------------------------- /tests/parse_error_haste/Unimported.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Parse errors but not in flow and not imported. 3 | * Should see no parse errors for this file. 4 | * @providesModule Bar 5 | */ 6 | function f(s:string):string { ### // illegal token 7 | return s; 8 | } 9 | 10 | module.exports = { f: f } 11 | -------------------------------------------------------------------------------- /tests/parse_error_node/Client.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Client imports some but not all modules, 3 | * triggering/suppressing parse errors. 4 | * @flow 5 | */ 6 | 7 | // non-flow files should give parse errors if they're imported 8 | var A = require("./Imported"); // non-Flow file @providesModule Foo 9 | -------------------------------------------------------------------------------- /tests/parse_error_node/Imported.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Parse errors, imported, not in flow, no provides module. 3 | * Should see a parse error in this file, and module 4 | * not found in client. 5 | */ 6 | function f(s) { ### // illegal token 7 | return s; 8 | } 9 | 10 | module.exports = { f: f } 11 | -------------------------------------------------------------------------------- /tests/parse_error_node/Unimported.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Parse errors but not in flow and not imported. 3 | * Should see no parse errors for this file. 4 | * @providesModule Bar 5 | */ 6 | function f(s:string):string { ### // illegal token 7 | return s; 8 | } 9 | 10 | module.exports = { f: f } 11 | -------------------------------------------------------------------------------- /tests/return_new/test2.js: -------------------------------------------------------------------------------- 1 | declare class D { 2 | constructor(): { x: number }; // OK 3 | y: any; 4 | } 5 | 6 | var d = new D(); 7 | d.x = ""; // error, string ~/~ number (but property x is found) 8 | 9 | (new D: D); // error, new D doesn't have property y 10 | 11 | module.exports = D; 12 | -------------------------------------------------------------------------------- /tests/sealed/sealed.js: -------------------------------------------------------------------------------- 1 | var o = require('./proto'); 2 | 3 | o.z = 0; 4 | var x:string = o.x; 5 | 6 | var Bar = require('./function'); 7 | var a = new Bar(234); 8 | a.x = 123; 9 | a.y = 'abc'; // error, needs to be declared in Bar's constructor 10 | (a.getX(): number); 11 | (a.getY(): string); 12 | -------------------------------------------------------------------------------- /tests/dictionary/test.js: -------------------------------------------------------------------------------- 1 | type Params = {count: number; [name: string]: string}; 2 | type QueryFunction = (params: Params) => string; 3 | 4 | var o: { foo: QueryFunction } = { 5 | foo(params) { 6 | return params.count; // error, number ~/~ string 7 | } 8 | }; 9 | 10 | module.exports = o; 11 | -------------------------------------------------------------------------------- /tests/parse_error_haste/NoProvides.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Parse errors, imported, not in flow, no provides module. 3 | * Should see a parse error in this file, and module 4 | * not found in client. 5 | */ 6 | function f(s) { ### // illegal token 7 | return s; 8 | } 9 | 10 | module.exports = { f: f } 11 | -------------------------------------------------------------------------------- /tests/node_haste/foo/bar/client.js: -------------------------------------------------------------------------------- 1 | var docblock = require('qux/docblock'); 2 | var min = require('d3/min.js'); 3 | var corge = require('qux/corge'); 4 | 5 | // make sure we don't pick up non-header @providesModule 6 | // annotations - see node_modules/qux/docblock.js 7 | var unreachable = require('annotation'); 8 | -------------------------------------------------------------------------------- /tests/parse/parse.exp: -------------------------------------------------------------------------------- 1 | 2 | fail-flow-2.js:4:1,1: Unexpected token . 3 | 4 | fail-flow.js:3:1,1: Unexpected token . 5 | 6 | fail.js:1:1,1: Unexpected token . 7 | 8 | no_parse_error.js:6:13,13: string 9 | This type is incompatible with 10 | no_parse_error.js:6:9,13: number 11 | 12 | Found 4 errors 13 | -------------------------------------------------------------------------------- /tests/react/proptype_oneOf.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var React = require('react'); 4 | var Example = React.createClass({ 5 | propTypes: { 6 | literal: React.PropTypes.oneOf(["foo"]).isRequired 7 | }, 8 | }); 9 | 10 | var ex1 = ; 11 | var ex2 = ; 12 | -------------------------------------------------------------------------------- /tests/export_default/lib/lib.js: -------------------------------------------------------------------------------- 1 | declare module M { 2 | declare function exports(x:string): string; 3 | } 4 | declare module N { 5 | declare var x: number; 6 | declare var y: number; 7 | declare var z: number; 8 | } 9 | declare module Q { 10 | declare var exports: $Exports<'M'>; 11 | } 12 | -------------------------------------------------------------------------------- /tests/react/jsx_spread.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var React = require('react'); 4 | var Foo = React.createClass({ 5 | propTypes: { 6 | bar: React.PropTypes.string.isRequired, 7 | }, 8 | }); 9 | 10 | var props = {bar: 42}; 11 | var blah = ; // error bar, number given string expected 12 | -------------------------------------------------------------------------------- /tests/taint-libs/D2172778-fixed.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | var fbLawEnforcementRetentionDialog = { 4 | 5 | init: function(dialog : any, download_uri : $Tainted) { 6 | dialog.subscribe('confirm', function() { 7 | dialog.hide(); 8 | goURI(download_uri); 9 | }); 10 | } 11 | 12 | }; 13 | -------------------------------------------------------------------------------- /tests/parse_error_haste/parse_error_haste.exp: -------------------------------------------------------------------------------- 1 | 2 | Client.js:8:9,22: Foo 3 | Required module not found 4 | 5 | Client.js:9:9,31: NoProvides.js 6 | Required module not found 7 | 8 | NoProvides.js:6:17,17: Unexpected token ILLEGAL 9 | 10 | Provides.js:8:33,33: Unexpected token ILLEGAL 11 | 12 | Found 4 errors 13 | -------------------------------------------------------------------------------- /tests/more_react/API.react.js: -------------------------------------------------------------------------------- 1 | 2 | var app = require('JSX'); 3 | 4 | app.setProps({y:42}); // error, y:number but foo expects string in App.react 5 | app.setState({z:42}); // error, z:number but foo expects string in App.react 6 | 7 | function bar(x:number) { } 8 | bar(app.props.children); // error, app.props.children: string 9 | -------------------------------------------------------------------------------- /tests/union/issue-198.js: -------------------------------------------------------------------------------- 1 | var p = new Promise(function(resolve, reject) { 2 | resolve(5); 3 | }) 4 | .then(function(num) { 5 | return num.toFixed(); 6 | }) 7 | .then(function(str) { 8 | // This should fail because str is string, not number 9 | return str.toFixed(); 10 | }); 11 | -------------------------------------------------------------------------------- /tests/generators/return.js: -------------------------------------------------------------------------------- 1 | function test1(gen: Generator) { 2 | // You can pass whatever you like to return, it doesn't need to be related to 3 | // the Generator's return type 4 | var ret = gen.return(123); 5 | (ret.done: false); // Error true ~> false 6 | (ret.value: 456); // Error 123 ~> 456 7 | } 8 | -------------------------------------------------------------------------------- /tests/incremental_basic/test.sh: -------------------------------------------------------------------------------- 1 | FLOW=$1 2 | mkdir tmp 3 | cp *.js tmp/ 4 | $FLOW status . --old-output-format 5 | cp tmp1/*.js ./ 6 | $FLOW status . --old-output-format 7 | cp tmp2/*.js ./ 8 | $FLOW status . --old-output-format 9 | cp tmp3/*.js ./ 10 | $FLOW status . --old-output-format 11 | mv tmp/*.js ./ 12 | rmdir tmp 13 | -------------------------------------------------------------------------------- /tests/incremental_cycle/test.sh: -------------------------------------------------------------------------------- 1 | FLOW=$1 2 | mkdir tmp 3 | cp *.js tmp/ 4 | $FLOW status . --old-output-format 5 | cp tmp1/*.js ./ 6 | $FLOW status . --old-output-format 7 | cp tmp2/*.js ./ 8 | $FLOW status . --old-output-format 9 | cp tmp3/*.js ./ 10 | $FLOW status . --old-output-format 11 | mv tmp/*.js ./ 12 | rmdir tmp 13 | -------------------------------------------------------------------------------- /tests/private/private.js: -------------------------------------------------------------------------------- 1 | class A { 2 | x: number; 3 | _x: string; 4 | __x: number; 5 | constructor() { this.x = 0; this._x = ""; this.__x = 0; } 6 | } 7 | 8 | class B extends A { 9 | foo() { 10 | var x: number = this.x; 11 | var _x: string = this._x; 12 | var __x: number = this.__x; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/taint-libs/D2172778-tainted.js: -------------------------------------------------------------------------------- 1 | // @flow 2 | 3 | var fbLawEnforcementRetentionDialog = { 4 | 5 | init: function(dialog : any, download_uri : $Tainted) { 6 | dialog.subscribe('confirm', function() { 7 | dialog.hide(); 8 | document.location = download_uri; 9 | }); 10 | } 11 | 12 | }; 13 | -------------------------------------------------------------------------------- /tests/modules/modules.exp: -------------------------------------------------------------------------------- 1 | 2 | cli2.js:5:1,8: function call 3 | Error: 4 | cli2.js:5:3,7: string 5 | This type is incompatible with 6 | lib.js:7:14,19: number 7 | 8 | lib.js:7:31,34: function call 9 | Error: 10 | lib.js:7:33,33: number 11 | This type is incompatible with 12 | lib.js:3:14,19: string 13 | 14 | Found 2 errors 15 | -------------------------------------------------------------------------------- /tests/optional/optional_param4.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | function foo(x?: number, ...y: Array): [?number, Array] { 4 | return [x, y]; 5 | } 6 | 7 | foo(); // OK 8 | foo(123), // OK 9 | foo(123, 'hello'); // OK 10 | 11 | 12 | foo(true); // ERROR boolean ~> number 13 | foo(123, true); // ERROR boolean ~> string 14 | -------------------------------------------------------------------------------- /tests/refinements/exists.js: -------------------------------------------------------------------------------- 1 | declare class Foo { 2 | foo: string; 3 | } 4 | 5 | function foo0(x: ?string): string { 6 | return x && x || ""; 7 | } 8 | 9 | function foo1(x: ?Foo): string { 10 | return x && x.foo || ""; 11 | } 12 | 13 | function foo2(x: ?Class): string { 14 | return x && new x().foo || ""; 15 | } 16 | -------------------------------------------------------------------------------- /tests/strict_requires/strict_requires.exp: -------------------------------------------------------------------------------- 1 | 2 | D.js:3:17,21: string 3 | This type is incompatible with 4 | D.js:3:8,13: number 5 | 6 | D.js:4:17,19: number 7 | This type is incompatible with 8 | D.js:4:8,13: string 9 | 10 | D.js:5:7,11: boolean 11 | This type is incompatible with 12 | C.js:3:8,21: number 13 | 14 | Found 3 errors 15 | -------------------------------------------------------------------------------- /tests/structural_subtyping/optional.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | interface HasOptional { 4 | a: string, 5 | b?: number, 6 | }; 7 | 8 | var test1: HasOptional = { a: "hello" } 9 | 10 | var test2: HasOptional = {}; // Error: missing property a 11 | 12 | var test3: HasOptional = { a: "hello", b: true }; // Error: boolean ~> number 13 | -------------------------------------------------------------------------------- /src/dts/tests/modules/declarations/modules.js.exp: -------------------------------------------------------------------------------- 1 | // Module declared on line 1 in .d.ts file 2 | declare module "M" { 3 | declare var x: number; 4 | declare class C { 5 | y: typeof x; 6 | } 7 | } 8 | declare var G_M: $Exports<'M'>; 9 | declare interface I { 10 | x: typeof G_M.x; 11 | get_y(c: G_M.C): typeof G_M.x; 12 | } 13 | -------------------------------------------------------------------------------- /tests/get-def/example.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | var lib = require('./library'); 4 | 5 | function add(a: number, b: number): number { 6 | return a + b; 7 | } 8 | 9 | var re = /^keynote (talk){2} (lightning){3,5} (talk){2} closing partytime!!!/ 10 | 11 | // t123456 12 | add(lib.iTakeAString(42), 7); 13 | 14 | // D123456 15 | lib.bar(); 16 | -------------------------------------------------------------------------------- /tests/require/E.js: -------------------------------------------------------------------------------- 1 | /* @flow */ 2 | 3 | // Local `exports` var is just a ref to module.exports, so mutating the original 4 | // value will affect the exports object but re-binding it makes it useless and 5 | // does not affect the exports value. 6 | module.exports = { 7 | numberValue: 42 8 | }; 9 | 10 | exports = {stringValue: ''}; 11 | -------------------------------------------------------------------------------- /src/parser/test/run_all.sh: -------------------------------------------------------------------------------- 1 | DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 2 | 3 | node $DIR/run_esprima_tests.js 4 | esprima_exit=$? 5 | node $DIR/run_hardcoded_tests.js 6 | hardcoded_exit=$? 7 | 8 | if [ $esprima_exit -ne 0 ] || [ $hardcoded_exit -ne 0 ] ; then 9 | echo 10 | echo "FAILED: Some tests failed" 11 | exit 1 12 | fi 13 | -------------------------------------------------------------------------------- /tests/covariance/covariance.exp: -------------------------------------------------------------------------------- 1 | 2 | test.js:4:8,9: string 3 | This type is incompatible with 4 | test.js:2:24,29: number 5 | 6 | test.js:12:9,9: number 7 | This type is incompatible with 8 | test.js:13:11,16: string 9 | 10 | test.js:12:9,9: number 11 | This type is incompatible with 12 | test.js:14:15,20: string 13 | 14 | Found 3 errors 15 | -------------------------------------------------------------------------------- /tests/more_path/test.js: -------------------------------------------------------------------------------- 1 | class BaseClass { 2 | baseProp: string; 3 | } 4 | 5 | class ChildClass extends BaseClass { 6 | childProp: string; 7 | } 8 | 9 | function test(obj: BaseClass): string { 10 | if (obj instanceof ChildClass) { 11 | return obj.childProp_TYPO; // error (obj: ChildClass) 12 | } 13 | return obj.baseProp; 14 | } 15 | -------------------------------------------------------------------------------- /tests/reflection/reflection.exp: -------------------------------------------------------------------------------- 1 | 2 | type.js:2:19,23: string 3 | This type is incompatible with 4 | type.js:1:16,21: number 5 | 6 | type.js:3:19,23: string 7 | This type is incompatible with 8 | type.js:1:16,21: number 9 | 10 | type.js:6:11,15: string 11 | This type is incompatible with 12 | type.js:6:7,7: number 13 | 14 | Found 3 errors 15 | -------------------------------------------------------------------------------- /src/dts/tests/union/union.exp: -------------------------------------------------------------------------------- 1 | 2 | union.js:2:18,18: string 3 | This type is incompatible with 4 | union.js:2:9,14: number 5 | 6 | union.js:3:16,16: number 7 | This type is incompatible with 8 | union.js:3:16,16: string 9 | 10 | union.js:3:16,16: string 11 | This type is incompatible with 12 | union.js:3:16,16: number 13 | 14 | Found 3 errors 15 | -------------------------------------------------------------------------------- /tests/equals/equals.exp: -------------------------------------------------------------------------------- 1 | 2 | equals.js:7:2,8: non-strict equality comparison 3 | Error: 4 | equals.js:7:2,2: number 5 | Cannot be compared to 6 | equals.js:7:7,8: string 7 | 8 | equals.js:8:2,8: non-strict equality comparison 9 | Error: 10 | equals.js:8:2,3: string 11 | Cannot be compared to 12 | equals.js:8:8,8: number 13 | 14 | Found 2 errors 15 | -------------------------------------------------------------------------------- /tests/module_redirect/module_redirect.exp: -------------------------------------------------------------------------------- 1 | 2 | D.js:6:20,31: module `A` 3 | This type is incompatible with 4 | D.js:6:11,16: string 5 | 6 | D.js:7:20,31: module `A` 7 | This type is incompatible with 8 | D.js:7:11,16: string 9 | 10 | D.js:8:20,31: module `A` 11 | This type is incompatible with 12 | D.js:8:11,16: string 13 | 14 | Found 3 errors 15 | --------------------------------------------------------------------------------