this post was submitted on 10 Dec 2023
5 points (72.7% liked)

TypeScript

809 readers
1 users here now

founded 1 year ago
MODERATORS
 
top 2 comments
sorted by: hot top controversial new old
[โ€“] towerful@programming.dev 2 points 9 months ago* (last edited 9 months ago) (1 children)

I 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

[โ€“] Jimbabwe@lemmy.world 4 points 9 months ago

Typescript error in Post. Was expecting argument of type Link, received undefined.