react-hardware icon indicating copy to clipboard operation
react-hardware copied to clipboard

$JSXIntrinsics

Open iamdustan opened this issue 9 years ago • 0 comments

http://flowtype.org/blog/2016/02/02/Version-0.21.0.html#jsx-intrinsics

I’m fairly confident in the following, but haven’t had a chance to test it out at all yet.

/* @flow */
/* eslint-disable */

// JSXHelper is a type alias to make this example more concise.
// There's nothing special or magic here.
// JSXHelper<{name: string}> is a React component
// with the single string property "name", which has a default
// type JSXHelper<T> = Class<ReactComponent<T,T,mixed>>;

// $JSXIntrinsics is special and magic.
// This declares the types for `pin`
declare type $JSXIntrinsics = {
  pin: JSXHelper<{
    mode: 'INPUT'|'OUTPUT'|'ANALOG'|'PWM'| 'SERVO'|'SHIFT'|'I2C'|'ONEWIRE'|'STEPPER'|'IGNORE'|'UNKNOWN';
    pin: number|string;
    value: number;
    onRead: ?(...arg:any) => any;
  }>;

  container: JSXHelper<{}>;
};

iamdustan avatar Apr 22 '16 14:04 iamdustan