I have data its type is ItemDTO. I want to pass it into a function that accepts an argument of type Item.
Typescript is complaining that this might be a mistake because the two types do not sufficiently overlap and if it's intentional to convert to unknown first.
Why does this work? What is it about converting a type to unknown first that works?
Said another way:
function foo(arg: Item){}
const data: ItemDTO = {key: 123}
const results = foo(data as Item) // this doesn't work
const alternative = foo((data as unknown) as Item) // this works