SlimTim10@programming.dev to TypeScript@programming.dev · 11 months agoTypeScript's Hidden Feature: Subtypesprogramming.devimagemessage-square3fedilinkarrow-up19arrow-down13
arrow-up16arrow-down1imageTypeScript's Hidden Feature: Subtypesprogramming.devSlimTim10@programming.dev to TypeScript@programming.dev · 11 months agomessage-square3fedilink
minus-squaretowerful@programming.devlinkfedilinkarrow-up3·edit-211 months agoI presume the details of this post got lost somewhere? let x = () => ({ name: "Alice" }); let y = () => ({ name: "Alice", location: "Seattle" }); x = y; // OK y = x; // Error, because x() lacks a location property` https://www.typescriptlang.org/docs/handbook/type-compatibility.html There doesn’t seem to be an article directly on subtypes
minus-squareJimbabwe@lemmy.worldlinkfedilinkarrow-up4·11 months agoTypescript error in Post. Was expecting argument of type Link, received undefined.
I presume the details of this post got lost somewhere?
https://www.typescriptlang.org/docs/handbook/type-compatibility.html
There doesn’t seem to be an article directly on subtypes
Typescript error in Post. Was expecting argument of type Link, received undefined.