Open
Description
Hello,
we are in the process in porting our jsx codebase to ts, we are getting there, but there are still some JS[X] files that need to be rewritten
In the mean time, we are relying on jsdoc to [very] pseudo type the remaining files,
with something like this :
/**
* @param {Object} props
* @param {string|null} [props.hint]
* @param {ReactNode} props.value
* @param {number} [props.iconSize]
* @param {string} [props.className]
* @param {boolean} [props.preventDefault]
* @param {boolean} [props.external]
* @param {string} [props.schemaBuiltinKey]
*
*/
const AttributeStringHint = ({ hint, value, iconSize = 14, className, preventDefault, external, schemaBuiltinKey }) => {
note the [ ] , that mark the prop as optional here in the react component
then if i can from a tsx file like this
<AttributeStringHint key={index} hint={attr.hint} value={value} />
i got with the current preview
Attribute.tsx:160:8 - error TS2739: Type '{ key: number; hint: SchemaAttributeHint | null | undefined; value: string; }' is missing the following properties from type '{ className: any; external: any; hint: any; iconSize?: number | undefined; preventDefault: any; schemaBuiltinKey: any; value: any; }': className, external, preventDefault, schemaBuiltinKey
160 <AttributeStringHint key={index} hint={attr.hint} value={value} />
in current ts, everything is ok of course