3 ms·
> you can always just... extend a class (or interface) with whatever function you want Not quite. Extension functions are statically resolved and abide by usua
by lf-non 5y ago
> you can always just... extend a class (or interface) with whatever function you want
Not quite. Extension functions are statically resolved and abide by usual access modifiers.
So within a class, I can have a private extension method for another class (say C). Now if my class receives any instance of C, I can call these extension methods on this instance. But when I forward this instance to someone else, they wont have access to any of these extensions.
Libraries like exposed use this quite extensively.
> Most everything else seems to come down to "Typescript is meant to be runtime-only"
Yes, this one too because it would involve type directed emit.