milesj/babel-plugin-typescript-to-proptypes

Order of type declaration is significant

thielium opened this issue · 2 comments

Steps to reproduce

The following fixture receives no PropTypes.

import React from 'react';
export default class OutOfOrder extends React.Component<Props> {
  render() {
    return null;
  }
}
export interface Props {
  b: string;
}

Moving the Props to the top of the file does yield PropTypes.

Here's the fixture + expected snapshot; thought that might be easier than posting in the comment.

This is intentional. There were issues on generating prop types in Program:exit, so they're generated when a class is found. I'll look into this again but it may just be a caveat to deal with.

This should work now.