vs. unknown

any

  • Variables of type any can be assigned any value[
  • You can perform any operation on any without type checks[
  • Compatible with all other types in TypeScript[

unknown

  • Variables of type unknown can also be assigned any value
  • You must perform type checks or type assertions before using unknown variables
  • Not compatible with other types without type narrowing or assertion