Instead of writing this in Typescript:
const ADMIN_PRODUCT = useAdminProduct();
const mode = ADMIN_PRODUCT.mode;
const product = ADMIN_PRODUCT.product as TYPES.PRODUCT; // I NEED TO ASSERT: product as TYPES.PRODUCT
const invalidFields = ADMIN_PRODUCT.invalidFields;
I would like to use object destructuring and do type assertion at the same time:
const {mode, product as TYPES.PRODUCT, invalidFields} = useAdminProduct();
But that does not work. Can I do it in some other similar way?
You could try: