Shouldn’t I get the same error? It’s the same situation, assigning a function to a number | Function
type and calling it:
type Treta = {
name: string,
stuff: number | Function
}
const obj1 = {
name: "Paulo",
stuff: () => {}
} satisfies Treta;
obj1.stuff() // No error!
const obj2: Treta = {
name: "Paulo",
stuff: () => {}
};
obj2.stuff();
// ^^^^ ERROR: No constituent of type 'number | Function' is callable.
type Other = number | Function;
const obj3 : Other = () => {};
obj3(); // No error even without satisfies
TS Playground link
3