Skip to content

$JSXIntrinsics #12

@iamdustan

Description

@iamdustan

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<{}>;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions