Current section: TypeScript 59 exercises
solution

Satisfies

Loading solution

Transcript

00:00 All right, so we want to get rid of this operator type because it's not allowing us to have the narrow type or the Derived type of operations We want to remove the type cast so we're going to get rid of this thing and instead we're going to put it Here because we do still want the left and right and the return value to all be

00:23 Typed automatically for us. So instead we're going to move that here and say satisfies and With satisfies now we can do a wide type But not lose the narrowness that we get naturally from having our operations right here like this and So now if we look at operations

00:42 It is an object that has all these properties and all these things are typed and we don't have to type them ourselves We just say hey this narrow thing Satisfies this wide thing and so we don't lose the narrowness that we're looking for so if we come down here, we will still get our autocomplete and

01:00 Our type safety, which is awesome. That is satisfactory