minuux
V2EX  ›  React

react-native 例子中的这个语法叫什么?

  •  
  •   minuux · Jun 4, 2015 · 4554 views
    This topic created in 4016 days ago, the information mentioned may be changed or developed.

    链接:
    https://github.com/facebook/react-native/blob/master/Examples/2048/GameBoard.js

    代码第35行
    ···
    var Tile = function (value?: number, row?: number, column?: number) {

    };
    ···
    value?: number, row?: number, column?: number这个是个什么语法?

    3 replies    2015-06-05 18:22:19 +08:00
    zythum
        1
    zythum  
       Jun 4, 2015
    用 babel 转换为 var Tile = function Tile(value, row, column) {};

    所以估计是某个es7的冷门规范。估计是规定类型什么(类似typescript),但是具体规范在哪没找到....
    leofml
        2
    leofml  
       Jun 4, 2015   ❤️ 2
    facebook 出的 http://flowtype.org/

    Flow is a static type checker, designed to find type errors in JavaScript programs
    amphineko
        3
    amphineko  
       Jun 5, 2015 via iPhone
    condition ? value-true : value-false

    就是 ? 运算符吧
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   975 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 19:38 · PVG 03:38 · LAX 12:38 · JFK 15:38
    ♥ Do have faith in what you're doing.