I just switched to Typescript recently and I have some problem with one case in my code. For example there's a function like this
async function reportIssue(issue: TIssue, document_id: number) {}
so I did select type for issue in this case. But in project we also use another type
type Dictionary<T = any> = { [key: string]: T }
And we using that Dictionary type as Type for submit callbacks.
So there's option to have if statement in reportIssue parameters types
if parameter issue has type return that type else return Dictionary?
Aucun commentaire:
Enregistrer un commentaire