Message from JavaScript discussions

November 2020

— Which doesn't mean that that type is "assignable" to the fs type


So if you have a function that takes fs, you can't provide an implementation of only the above and also make the type system happy

— TS does not differentiate between my self-constructed type signature, if it matches with the existing one?

Message permanent page

— Nope, that's structural typing

— It essentially traverses the structures, doing a deep equality check

— Before deciding if the types match

— Aah :O

— This is what you meant then

— It's quite powerful, this example shows that it even works for infinitely recursing types

— This type is constructed such that: // -> foo

— Yes

— Notice how passing my foo variable into my meme function which takes bar still works