LearningTypeScript / projects

Hands-on real world projects that will help you exercise your knowledge of TypeScript.
https://learningtypescript.com/projects
235 stars 156 forks source link

🐛 Bug: [the-shape-of-types] #183

Closed scalixtro closed 1 year ago

scalixtro commented 1 year ago

Bug Report Checklist

Expected

Class MockHorror is assignable to exported class Horror.

Actual

Got an error Argument of type 'MockHorror' is not assignable to parameter of type 'Horror & Horror'. Type 'MockHorror' is missing the following properties from type 'Horror': #consumed, #consume, doBattle, getPower when I run the command npm run tsc -- --watch in the the-shape-of-types project.

Impacted Project

projects/classes/the-shape-of-types

Additional Info

JoshuaKGoldberg commented 1 year ago

Hmm, looks like an introduced failure in new versions of TypeScript. It used to be TypeScript understood all the classes -Demon, Horror, Sorcerer- to be coming from the same place, so instances of Horror would all be assignable to each other. Newer versions of TypeScript no longer seem to. I'll send a PR to fix. Thanks for reporting @scalixtro!

JoshuaKGoldberg commented 1 year ago

This should be fixed if you pull in the latest commits on the main branch. Please do post back if that's not the case. Thanks again for reporting @scalixtro!