wix-incubator / vscode-glean

The extension provides refactoring tools for your React codebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No props validation for Typescript users?

gfang200 opened this issue · comments

Does Glean support typing props when extracting components?

For example, extracting the middle component:

 const hello = 'hello';
()=>{
  <div>
  <div>Hello world {hello}</div>
  <div>
}

returns a functional component where hello is cast as any

function HelloWorldComponent({hello}) {
  return (<div>Hello world {hello}</div>);
}

I'm wondering if it's possible infer and set the prop type, or do I need to set it manually in all cases?

function HelloWorldComponent({hello}:{hello:string}) {
   return (<div>Hello world {hello}</div>);
}