| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
I don't see this getting used anywhere apart from the later assignment.
Sorry, something went wrong.
There was a problem hiding this comment.
right, forgot to remove that. Thanks
Sorry, something went wrong.
There was a problem hiding this comment.
isGlobalAugmentation or augmentsGlobal
Sorry, something went wrong.
|
What exactly is the recommended way to augment a default export? Is it possible in this implementation? |
Sorry, something went wrong.
|
it is not possible |
Sorry, something went wrong.
|
This also appears to take care of #2784. You might want to take note and give a heads up on that issue when this goes in. |
Sorry, something went wrong.
There was a problem hiding this comment.
what about external modules with no exports or no module augmentation? soemthing like:
import {a} from "./mod";
// do something with a
Sorry, something went wrong.
There was a problem hiding this comment.
i thought we will do this for any external module, that we never emitted any import, export, or module augmentation for.
Sorry, something went wrong.
|
👍 |
Sorry, something went wrong.
There was a problem hiding this comment.
This should be checkModuleAugmentationElement. It checks and element in the body, not the body itself.
Sorry, something went wrong.
There was a problem hiding this comment.
✅
Sorry, something went wrong.
|
build failure is related to #6478 |
Sorry, something went wrong.
|
Anders Hejlsberg (@ahejlsberg) done, do you have any other comments? |
Sorry, something went wrong.
There was a problem hiding this comment.
The error message below seems a bit odd for this case, but maybe it's fine.
Sorry, something went wrong.
There was a problem hiding this comment.
for global case we can easily lift this restriction since it is possible to add new entries to global scope from within a module. Currently the fact that we have it is only because of consistency in behavior for augmentations.
Sorry, something went wrong.
There was a problem hiding this comment.
No sure I understand, maybe we're talking about different issues. This code is saying that you get an error when you have an exported member in a global augmentation block, right? I'm thinking it should never be valid to use export in a global augmentation block.
Sorry, something went wrong.
There was a problem hiding this comment.
the idea of this check is following: symbol.parent will be undefined if symbol was initially defined in the global scope. If symbol.parent is not undefined this means that this symbol was declared inside augmentation and will declare new entry in the global scope which is disallowed in current design
Sorry, something went wrong.
There was a problem hiding this comment.
If symbol.parent is not undefined this means that this symbol was declared inside augmentation
Why is that so? symbol.parent is non-undefined when the symbol is exported, but it might still be declared inside the augmentation. I'm not getting this.
Sorry, something went wrong.
There was a problem hiding this comment.
symbols whose initial declaration is in global scope are never exported and symbol.parent for them is always undefined. if symbol.parent !== undefined this means that this symbol is exported from somewhere and as a consequence initially defined in augmentation not in global scope
Sorry, something went wrong.
|
In map.ts: since the ambient module declaration advertises to the compiler that Observable<T> has a map member, would you be able to attach a function of the appropriate kind to the prototype without casting to <any>? |
Sorry, something went wrong.
There was a problem hiding this comment.
I have a hard time reasoning about this.
Sorry, something went wrong.
There was a problem hiding this comment.
this assert is redundant. it basically says: augmentation can only change exported symbol (parent !== undefeind) that really has a declaration (not a virtual symbol like prototype) - this should always be the case. I'll remove it
Sorry, something went wrong.
There was a problem hiding this comment.
So did you mean symbol.valueDeclaration !== undefined? You currently have symbol.parent.valueDeclaration.
Sorry, something went wrong.
There was a problem hiding this comment.
symbol.parent.valueDeclaration - is an augmentation: declare module .... symbol.valueDeclaration is declaration inside the augmentation. Currently we report error if container that this symbol is module augmentation and not a normal external module
Sorry, something went wrong.
initial revision of external module augmentations
|
Awesome! Great stuff. Thank you! |
Sorry, something went wrong.
|
🎉 👏 👏 👏 👏 👏 👏 👏 |
Sorry, something went wrong.
|
👍 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Module augmentation is a declaration of ambient module that directly nested either in external module or in top level ambient external module.
Name of module augmentation is resolved using the same set of rules as module specifiers in import \ export declarations.
If name is successfully resolved to some external module then declarations in module augmentation are merged with declarations inside module using standard rules for declaration merging.
Module augmentations cannot add new items to the top level scope but rather patch existing declarations.
for example
Here module map can declare that internally it will patch Observable type and add map function to it.
Fixes: #5269, #6022
Pending work:
or