Property 'autoFocus' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<

Viewed 557

Using the Component:

<SampleComponent defaultSelectId="AL" autoFocus={true} />

Component definition: (Notice: props does not contain "autoFocus")

interface IProps extends React.Props<any> { defaultSelectId?: string | number; } 

export class SampleComponent extends React.PureComponent<IProps, IState> { .... render() { 


return (
      <button

        {...props}
      />
 )};

}

Error: Property 'autoFocus' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Pick & Readonly, never> & Partial & Readonly<...>, "children"

Note: It was working perfectly fine until I updated the typescript. Since autoFocus is an attribute available in button, I don't want to add it in the props interface.

0 Answers
Related