| ▲ | ekimekim 6 hours ago | |
To provide a concrete example, this bit me in a typescript codebase:
Now imagine the definition of Option is in some library or other file and you don't realize how it works. You are thinking of the Option as its own structure and expect f to return Option<string | undefined>. But Option<string | undefined> = string | undefined | undefined = string | undefined = Option<string>.The mistake here is in how Option is defined, but it's a footgun you need to be aware of. | ||