2017-04-06 31 views
0

我開始學習graphql-js源代碼,但發現很難確定源代碼是寫在vanilla js還是typescript是否在Vanilla JavaScript中編寫graphql-js?

例如,主入口文件src/graphql.js具有下面的代碼:

import type { GraphQLSchema } from './type/schema'; 
import type { ExecutionResult } from './execution/execute'; 

我不認爲導入類型爲標準js語法。任何人都可以請幫忙解釋它是什麼嗎?

此外,下面的代碼看起來像TypeScript給我,但文件擴展名是js,不ts

function graphql( 
    schema: GraphQLSchema, 
    requestString: string, 
    rootValue?: mixed, 
    contextValue?: mixed, 
    variableValues?: ?{[key: string]: mixed}, 
    operationName?: ?string):: Promise<ExecutionResult> {} 

回答

0

問這個問題之後,我做了一些研究。顯然graphql-js使用Flow Type,這與TypeScript類似。來自Babel和Flow團隊的James Kyles很好地解釋了Flow TypeTypeScript之間的差異here

相關問題