I didn't attempt to convert prop types into appropriate typescript types. I'm skeptical that there is enough fidelity in this least-common-denominator type system - like, when we're getting back a Route or a View, react-proptypes will only represent that as an Object, right? And it would be nice to include the jsdoc documentation for each thing, mirroring what you have in the online docs for F7 about each component.
Good point about abstracting from F7. There are quite a few features like the core App component, the app-level extensions to it by each component's concerns, and reused F7 core types - if Phenome is agnostic, can it accommodate the core api somehow?
To save you the suspense, here's the generated output. Again, there's more type information in your AST than is represented yet, but we need a mechanism for converting its prop types to the most appropriate typescript type:
namespace MyPhenomeComponent {
export interface Props {
foo? : any
bar? : any
fooBar? : any
one : any
two? : any
onComponentOpen? : Function
onComponentClose? : Function
}
}
export class MyPhenomeComponent extends React.Component<MyPhenomeComponent.Props, {}> {
open(animate : any) : unknown
close(animate : any) : unknown
}
You don't have to really pull this in to your branch, a PR just seemed to be the easiest way to share it.
Cool! Here's some of it filled in.
I didn't attempt to convert prop types into appropriate typescript types. I'm skeptical that there is enough fidelity in this least-common-denominator type system - like, when we're getting back a
Route
or aView
, react-proptypes will only represent that as anObject
, right? And it would be nice to include the jsdoc documentation for each thing, mirroring what you have in the online docs for F7 about each component.Good point about abstracting from F7. There are quite a few features like the core App component, the app-level extensions to it by each component's concerns, and reused F7 core types - if Phenome is agnostic, can it accommodate the core api somehow?
To save you the suspense, here's the generated output. Again, there's more type information in your AST than is represented yet, but we need a mechanism for converting its prop types to the most appropriate typescript type:
You don't have to really pull this in to your branch, a PR just seemed to be the easiest way to share it.