Javascript 在本机初学者工具包中,函数调用后的冒号是什么意思

Javascript 在本机初学者工具包中,函数调用后的冒号是什么意思,javascript,reactjs,react-native,ecmascript-6,Javascript,Reactjs,React Native,Ecmascript 6,我正在努力学习React Native,我正在学习Native初学者工具包中的代码。我无法理解以下代码。我知道函数调用后的冒号通常是静态类型检查器(如TypeScript)的类型定义,因为我在Angular项目中使用它,但就我所见,starter项目没有使用类似的东西 类型文件: package.json文件: 谢谢。这是使用流的静态类型检查 检查您将看不到它,但此工具包很可能依赖.ts进行类型检查。因此,“/types”中的行导入类型{Action}请注意,这在react native中也不

我正在努力学习React Native,我正在学习Native初学者工具包中的代码。我无法理解以下代码。我知道函数调用后的冒号通常是静态类型检查器(如TypeScript)的类型定义,因为我在Angular项目中使用它,但就我所见,starter项目没有使用类似的东西

类型文件:

package.json文件:


谢谢。

这是使用流的静态类型检查


检查

您将看不到它,但此工具包很可能依赖.ts进行类型检查。因此,“/types”中的行
导入类型{Action}请注意,这在react native中也不是必需的。您可以在不使用静态类型的情况下构建项目。
export type Action =
  { type: 'PUSH_NEW_ROUTE', route: string }
    | { type: 'POP_ROUTE' }
    | { type: 'POP_TO_ROUTE', route: string }
    | { type: 'REPLACE_ROUTE', route: string }
    | { type: 'REPLACE_OR_PUSH_ROUTE', route: string }
    | { type: 'OPEN_DRAWER'}
    | { type: 'CLOSE_DRAWER'}
    | { type: 'SET_USER', name: string}
    | { type: 'SET_LIST', list: string}

export type Dispatch = (action:Action | Array<Action>) => any;
export type GetState = () => Object;
export type PromiseAction = Promise<Action>;
import type { Action } from './types';

export const SET_USER = 'SET_USER';

export function setUser(user:string):Action {
  return {
    type: SET_USER,
    payload: user,
  };
}
{
  "name": "NativeStarterKit",
  "version": "6.1.0",
  "private": true,
  "scripts": {
    "postinstall": "remotedev-debugger",
    "start": "node_modules/react-native/packager/packager.sh",
    "eslint": "eslint",
    "test": "jest"
  },
  "dependencies": {
    "color": "^0.11.3",
    "lodash": "^4.13.1",
    "moment": "^2.13.0",
    "native-base": "2.1.1",
    "react": "16.0.0-alpha.3",
    "react-native": "0.43.1",
    "react-native-code-push": "2.0.1-beta",
    "react-native-easy-grid": "0.1.8",
    "react-native-modalbox": "^1.3.4",
    "react-native-router-flux": "3.38.0",
    "react-redux": "^5.0.2",
    "redux": "^3.6.0",
    "redux-persist": "^4.0.0",
    "redux-thunk": "^2.2.0",
    "remote-redux-devtools": "^0.5.0"
  },
  "devDependencies": {
    "babel-eslint": "^6.1.2",
    "babel-jest": "17.0.0",
    "babel-preset-react-native": "1.9.0",
    "chai": "^3.5.0",
    "eslint": "^3.5.0",
    "eslint-config-airbnb": "^11.1.0",
    "eslint-plugin-import": "^1.14.0",
    "eslint-plugin-jsx-a11y": "^2.2.1",
    "eslint-plugin-react": "^6.2.0",
    "eslint-plugin-react-native": "^2.0.0",
    "jest": "17.0.0",
    "jest-react-native": "17.0.0",
    "mocha": "^2.5.3",
    "react-test-renderer": "15.3.2",
    "remote-redux-devtools-on-debugger": "^0.7.0",
    "remotedev-server": "^0.1.2"
  },
  "keywords": [
    "android",
    "ios",
    "react",
    "native",
    "react-native",
    "native-base",
    "native-modules",
    "react-component",
    "navbar",
    "packager",
    "rnpm",
    "es6",
    "redux",
    "react-native-code-push",
    "react-native boilerplate",
    "react-native with redux",
    "react-native with redux boilerplate",
    "native-base boilerplate",
    "react-native with native-base"
  ],
  "upstreamRepo": "git@github.com:GeekyAnts/react-native-native-base-seed.git",
  "jest": {
    "preset": "jest-react-native"
  }
}