Check out example codes for "typescript convert an unknown to string". It will help you in understanding the concepts better.
Code Example 1
// To convert an unknown type into any other type we can use assertions let demo: unknown = 'Rice Krispies'; // The above line would throw an error as an unknown variable can // only take values of unknown and any type let demo: unknown = 'The EXTRA cripsy colonel...' as string; // the as string assertion allows us to set an unknown type to a string type // This can be done with any other variable types it is not // limited to string
Learn ReactJs, React Native from akashmittal.com