-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Unable to do module augmentation (1.8 beta) #6722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem is that express.d.ts uses an |
For now, is there a hack to work around this (other than supplying my own version of Express's type definition file)? |
@ahejlsberg just to clarify: do we want to allow augmentation for |
Why not augment the global declaration that declare global {
namespace Express {
interface Request {
......
}
}
}
` |
Yes, we should do it only if the export = entity has a namespace meaning. On Jan 29, 2016, at 8:02 AM, Vladimir Matveev <[email protected]mailto:[email protected]> wrote: @ahejlsberghttps://github.com./ahejlsberg just to clarify: do we want to allow augmentation for export = entities only if they have namespace meaning (which is more in line with our existing behavior). Reply to this email directly or view it on GitHubhttps://github.com.//issues/6722#issuecomment-176837450. |
This entity might also be visible from outside the module. augmenting it, would be unexpected, i would argue. most of the definitely typed I think our position of modules with |
had a discussion with @vladima offline. I think i see how this works conceptually now. |
Also, @mhegazy - express doesn't use a global declare module "express" {
function e(): e.Express;
module e {
//...
}
export = e;
} which, without being able to merge into the |
Luckily in my specific use case, the |
Hi @vladima |
The above code sits alone in a file that I then import from various locations.
The code fails to compile, warning
Module augmentation cannot introduce new names in the top level scope.
The text was updated successfully, but these errors were encountered: