Skip to content

Commit 4c4124c

Browse files
elicwhitedanez
authored andcommitted
Support flow type variance (#240)
1 parent cdc3fb9 commit 4c4124c

File tree

4 files changed

+68
-10
lines changed

4 files changed

+68
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"commander": "^2.9.0",
3939
"doctrine": "^2.0.0",
4040
"node-dir": "^0.1.10",
41-
"recast": "^0.12.6"
41+
"recast": "^0.13.0"
4242
},
4343
"devDependencies": {
4444
"babel-cli": "^6.26.0",

src/__tests__/__snapshots__/main-test.js.snap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,27 @@ Object {
260260
},
261261
}
262262
`;
263+
264+
exports[`main fixtures processes component "component_11.js" without errors 1`] = `
265+
Object {
266+
"description": "",
267+
"displayName": "MyComponent",
268+
"methods": Array [],
269+
"props": Object {
270+
"prop1": Object {
271+
"description": "The first prop",
272+
"flowType": Object {
273+
"name": "string",
274+
},
275+
"required": true,
276+
},
277+
"prop2": Object {
278+
"description": "The second, covariant prop",
279+
"flowType": Object {
280+
"name": "number",
281+
},
282+
"required": true,
283+
},
284+
},
285+
}
286+
`;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2015, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
*/
10+
11+
/**
12+
* Testing component using Flow
13+
*/
14+
15+
import React from 'react';
16+
17+
type Props = {|
18+
/**
19+
* The first prop
20+
*/
21+
prop1: string,
22+
23+
/**
24+
* The second, covariant prop
25+
*/
26+
+prop2: number
27+
|}
28+
29+
class MyComponent extends React.Component<Props> {
30+
render() {
31+
return null;
32+
}
33+
}
34+
35+
export default MyComponent;

yarn.lock

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ assert-plus@^0.2.0:
215215
version "0.2.0"
216216
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-0.2.0.tgz#d74e1b87e7affc0db8aadb7021f3fe48101ab234"
217217

218-
ast-types@0.9.14:
219-
version "0.9.14"
220-
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.14.tgz#d34ba5dffb9d15a44351fd2a9d82e4ab2838b5ba"
218+
ast-types@0.10.1:
219+
version "0.10.1"
220+
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.10.1.tgz#f52fca9715579a14f841d67d7f8d25432ab6a3dd"
221221

222222
astral-regex@^1.0.0:
223223
version "1.0.0"
@@ -1045,7 +1045,7 @@ convert-source-map@^1.4.0, convert-source-map@^1.5.0:
10451045
version "1.5.0"
10461046
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.5.0.tgz#9acd70851c6d5dfdd93d9282e5edf94a03ff46b5"
10471047

1048-
core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0:
1048+
core-js@^2.4.0, core-js@^2.5.0:
10491049
version "2.5.1"
10501050
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.1.tgz#ae6874dc66937789b80754ff5428df66819ca50b"
10511051

@@ -2793,12 +2793,11 @@ readdirp@^2.0.0:
27932793
readable-stream "^2.0.2"
27942794
set-immediate-shim "^1.0.1"
27952795

2796-
recast@^0.12.6:
2797-
version "0.12.8"
2798-
resolved "https://registry.yarnpkg.com/recast/-/recast-0.12.8.tgz#bb5dc9501dfa0cd075686e1daf9d67797cc5499f"
2796+
recast@^0.13.0:
2797+
version "0.13.0"
2798+
resolved "https://registry.yarnpkg.com/recast/-/recast-0.13.0.tgz#a343a394a37d24668d700f88ed04b8d2c314d40d"
27992799
dependencies:
2800-
ast-types "0.9.14"
2801-
core-js "^2.4.1"
2800+
ast-types "0.10.1"
28022801
esprima "~4.0.0"
28032802
private "~0.1.5"
28042803
source-map "~0.6.1"

0 commit comments

Comments
 (0)