| ▲ | nixpulvis 9 hours ago | |
Why is satisfies needed at all, when can't. Typescript realize that `a` satisfies `Rect` automatically? | ||
| ▲ | ameliaquining 9 hours ago | parent | next [-] | |
It does; the code will still type-check without the satisfies operator. satisfies lets you say "if this value doesn't conform to this type then I want that to be an immediate compile error, even if it would otherwise be okay". Which isn't needed all that often since usually getting the type wrong would produce a compile error elsewhere, but occasionally it proves useful. When designing the feature they collected some use cases: https://github.com/microsoft/TypeScript/issues/47920 | ||
| ▲ | 9 hours ago | parent | prev [-] | |
| [deleted] | ||