There is an "unknown" type in TypeScript

TypeScript provides an unknown type which is just like any, but not assignable to anything:

const first: any = 42;
const second: unknown = 42;

const foo: number = first; // this is valid...
const bar: number = second; // ...while this is NOT

This brings an additional layer of type safety, especially on system borders - we may want to make sure a specific variable won’t accidentally “leak” to the rest of the system and cause runtime errors due to incorrect type assumptions.

More details can be found here.