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
moment.d.ts is not compatible with 'none' module compiler option #3663
Comments
For googlers: Changing
works. (OP forgot the equals char) |
Given the staleness, I'm going to assume that the comment answered your question. Let me know if it didn't. |
@maggiepint I don't think that this issue is a question. I think that moment`s declaration file should be changed so that it can work without any module system. |
I'm not looking for answer, because I mentioned the same in Notes section. I would like to see this changes in moment's declaration. |
This issue is still not fixed in v2.18.0. Why is this bug closed? |
I'll re-open this, but the solution needs to be Typescript 1.x compatible and non-breaking. For Moment.js 3.x (coming soon!) we will support Typescript 2.x and can do some breaking changes. |
Closing this as it is a duplicate of #3763 which has more traffic . We still do need a fix! |
I have web application that doesn't use any kind of modules, tsconfig.json ->
compilerOptions { "module": "none" }
. I tried to use declaration file from package with it, but always geterror TS2304: Cannot find name 'moment'
.Steps to reproduce:
create application folder
add typescript config and set
compilerOptions { "module": "none" }
in tsconfig.jsonadd moment package via npm
add
main.ts
with some "moment" code (example:console.log(moment.version)
)try build with tsc
error TS2304 occurred
copy moment.d.ts to application folder
try build with tsc
error TS2304 occurred
add
///<reference path='./moment.d.ts'/>
try build with tsc
error TS2304 occurred
Environment:
npm: 3.10.9
typescript: 2.1.4
moment: 2.17.1
Notes:
Declaration file from the typings works well, and moment it's the only package why I'm still using typings in my project. I checked what the difference is and difference is how they export moment. Instead of
export moment
they usedeclare module "moment" { export moment; }
The text was updated successfully, but these errors were encountered: