V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
minuux
V2EX  ›  React

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

  •  
  •   minuux · Jun 4, 2015 · 4479 views
    This topic created in 3982 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   ·   938 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 20:30 · PVG 04:30 · LAX 13:30 · JFK 16:30
    ♥ Do have faith in what you're doing.