Is it possible to achieve something like this?
interface User {
name: string;
age: number;
}
// The syntax User['*'] is just an example, not a real feature
const user: User['*'] = 'Bob'; // No error
const user: User['*'] = 32; // No error
const user: User['*'] = true; // Error
I'm aware of the "or" (|
) operator, but it can get redundant if the User
interface has many typed properties.