Is there any way in typescript / typescript-eslint to render an error when an optional parameter does not have a a default value? I am trying to convert my React codebase from JSX to TSX and no longer having the warnings about not having defaultProps defined is worrisome. Thanks.
bad: title does not have default prop value
import * as React from 'react';
interface Props {
title?: string;
}
const SampleComponent: React.FC<Props> = ({ title }) => (
<h1>
{title && <p>{title}</p>}
</h1>
);
export default SampleComponent;
good: title has default prop value
import * as React from 'react';
interface Props {
title?: string;
}
const SampleComponent: React.FC<Props> = ({ title = 'foo' }) => (
<h1>
{title && <p>{title}</p>}
</h1>
);
export default SampleComponent;