-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Module Augmentation fails when exports are declared in an ExportClause #8427
Comments
The behavior is what i would expect. the error message could be better. also note, you do not need the // ext2.d.ts
declare module "State" {
interface IState {
str: string;
}
} |
If the two are semantically equivalent then why does the the former producer errors while the later does not? That is, if both interface declarations omit the export and are implicitly exported instead then the code compiles. With regards to the use of the |
It seems I also stumbled on this problem.
I don't understand is this error a bug or not? |
looking at this again, this is the same issue as #8140. |
closing in favor of #8140. |
All the same I don't understand. Should it work or not?
Now there is no errors, but _gulp still hasn't my function. |
I think it should not work, and it should be an error. currently it is not an error, but it does not work as expected.
you should use module augmentation instead: import gulp = require("gulp");
// augment the module
declare module "gulp" {
interface Gulp {
devTask(name: string): void;
}
}
gulp.devTask = function () {
if (process.env.NODE_ENV !== 'production') return gulp.task.apply(this, arguments);
} |
You code throws an error. |
what version of TS are you using? |
Typescript for Microsoft Visual Studio 1.8.29.0. |
looks like you are running into #7545, which has been fixed after 1.8. |
What is the last version? Is there a way to get version of TypeScript used for compiling? Because I'm not sure what TS version VS is using. |
What is available currently is the nightly builds ( |
I mean something kind of Ok, I installed typescript@next. And read this https://github.com/Microsoft/TypeScript/wiki/Dev-Mode-in-Visual-Studio |
VS stores options in the registry as well :) |
We're seeing a similar error. After doing
On build with
We have also tried this approach:
In that case, the actual behavior is that the
|
TypeScript Version:
nightly (1.9.0-dev.20160502)
Code
Expected behavior:
The "State" module and IState interface declarations should be merged and the code should compile without errors.
Actual behavior:
The declaration files report error
TS2300: Duplicate identifier 'IState'
Workaround:
The above errors do not occur when both IState interfaces are exported inline using the export modifier instead of in a ExportClause.
NOTE: If the first is exported inline and the second is exported in an ExportClause then the second declaration errors with
TS2482: Export declaration conflicts with exported declaration of 'IState'
.The text was updated successfully, but these errors were encountered: