FlowType 用来定义接口的语言是什么?

What is the language FlowType uses to define interfaces?

FlowType interface files are declared using a certain language. This page contains some examples。我在哪里可以获得该语言的概述,或者演示所有可用的冗长接口文件的示例 tokens/types/features?

declare moduledeclare class 您在示例页面中看到的是 TypeScript : 你可以在官方site.

了解语言

基本上,Typescript 使用更多 oriented-object 语法来编写您的 javascript 应用程序(最后,它会将您的代码编译为 javascript)。

关于如何使用 Flow 的示例,您可以在 Flow Github repo

中找到 reference of Flow and even find examples

文档中的 Quick Reference 页面很好地概述了所有语言功能。 Flow GitHub 存储库中的 lib directory 包含 JavaScript 标准库、DOM、React 和 Node 的类型定义,它们是很好的起点。

TypeScript 和 Flow 的语法有很大程度的重叠,因此您最喜欢的库的 DefinitelyTyped TypeScript 定义将为您提供一些可能在 Flow 中工作的东西,只需进行一些小的修改。对于初学者来说,两者之间的最大区别在于您的配置方式和 运行 它们。

这里有一个快速概览:

declare module ModuleName {
  ...more declare statements
}
declare module "QuotedModuleName" {
  ...more declare statements
}
declare module ModuleWithDefaultExport {
  // declare class exports or declare function exports also works
  declare var exports: exportType;
}
declare class ClassName {
  propertyName: propertyType;
  methodName(arg1: argType): returnType;
}
declare function functionName(arg1: argType): returnType;
declare var varName: varType;
interface InterfaceName {
  propertyName: propertyType;
  methodName(arg1: argType): returnType;
}
type TypeName = someType;

flow 二进制文件附带了一些嵌入其中的库文件。这些库指定了一些非常基本的东西,比如核心 JavaScript 内置函数、DOM API、Node 的 API 等 You can browse those lib files on github.