[英]Is graphql-js written in Vanilla JavaScript?
I started to learn graphql-js
source code, but found it is difficult to determine whether the source code is written in vanilla js
or typescript
? 我开始学习
graphql-js
源代码,但是发现很难确定源代码是用vanilla js
还是typescript
编写的?
For example, the main entry file src/graphql.js
has the following code: 例如,主条目文件
src/graphql.js
具有以下代码:
import type { GraphQLSchema } from './type/schema';
import type { ExecutionResult } from './execution/execute';
I don't think the import type is standard js
syntax. 我认为导入类型不是标准的
js
语法。 Can anyone please help explain what it is for? 谁能帮忙解释一下它的用途吗?
Also, the following code looks like TypeScript
to me, but the file extension is js
, not ts
: 另外,以下代码对我来说就像
TypeScript
,但是文件扩展名是js
,而不是ts
:
function graphql(
schema: GraphQLSchema,
requestString: string,
rootValue?: mixed,
contextValue?: mixed,
variableValues?: ?{[key: string]: mixed},
operationName?: ?string):: Promise<ExecutionResult> {}
After asking the question, I did some research. 问了问题之后,我做了一些研究。 Apparently
graphql-js
uses the Flow Type , which is similar to TypeScript
. 显然
graphql-js
使用Flow Type ,它与TypeScript
相似。 James Kyles from Babel and Flow team explained the difference between Flow Type
and TypeScript
very well here Babel and Flow团队的James Kyles 在这里很好地解释了
Flow Type
和TypeScript
之间的区别
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.