Skip to content

Commit

Permalink
annotate unannotated non-liftable state with ExistsType instead of ob…
Browse files Browse the repository at this point in the history
…ject type (facebook#68)
  • Loading branch information
keyz authored Jul 20, 2016
1 parent 228489a commit 6b618ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions transforms/__testfixtures__/class-initial-state.output.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class App extends React.Component {
}

class App2 extends React.Component {
state: Object;
state: *;

constructor(props, context) {
super(props, context);
Expand All @@ -81,7 +81,7 @@ App.contextTypes = {
};

class MyComponent2 extends React.Component {
state: Object;
state: *;

constructor(props) {
super(props);
Expand All @@ -100,7 +100,7 @@ class MyComponent2 extends React.Component {
const getContextFromInstance = (x) => x.context; // meh

class MyComponent3 extends React.Component {
state: Object;
state: *;

constructor(props, context) {
super(props, context);
Expand Down Expand Up @@ -141,7 +141,7 @@ class MyComponent5 extends React.Component {

// intense control flow testing
class Loader extends React.Component {
state: Object;
state: *;

constructor(props, context) {
super(props, context);
Expand Down Expand Up @@ -183,7 +183,7 @@ class Loader extends React.Component {
}

class FunctionDeclarationInGetInitialState extends React.Component {
state: Object;
state: *;

constructor(props) {
super(props);
Expand Down Expand Up @@ -274,7 +274,7 @@ var ShadowingIssue = React.createClass({ // bail out here

// will remove unnecessary bindings
class ShadowingButFine extends React.Component {
state: Object;
state: *;

constructor(props, context) {
super(props, context);
Expand Down
2 changes: 1 addition & 1 deletion transforms/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ module.exports = (file, api, options) => {
maybeConstructor = createConstructor(getInitialState);
if (shouldTransformFlow) {
let stateType = j.typeAnnotation(
j.genericTypeAnnotation(j.identifier('Object'), null)
j.existsTypeAnnotation()
);

if (getInitialState.value.returnType) {
Expand Down

0 comments on commit 6b618ba

Please sign in to comment.