Issue
Is it any operator, or generic solution to take copy of nullable object, and the result should be the same nullable type?
Like here, but ... spread operator will not retain type.
const [startPaymentIn, setStartPaymentIn] = useState<
StartPaymentIn | undefined
>(undefined);
let startPaymentIn2: StartPaymentIn | undefined = {
...startPaymentIn,
};
Solution
This can retain the type...
startPaymentIn && {...startPaymentIn}
Answered By - Yusuf Ganiyu
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.