"Declare" keyword required, even in .d.ts files?

Topics: General, Language Specification
Apr 19, 2013 at 10:59 PM
So I was reading the wiki, and I saw that I have to put an explicit "declare" on top-level items in 0.9.0 even though previously the file extension of .d.ts alone made that known. I liked not having to specify "declare" on any item (even top-level) because I was doing so w/ the file extension. Maybe an empty declare block will be supported in the future. A lot of my ambient declarations are top level unfortunately.
Apr 23, 2013 at 12:45 AM
The reasoning here is that you can more easily copy/paste between the file types. The .d.ts files restricts the grammar down to only what is allowed in a declare, but it doesn't introduce new meanings to the existing language features, which was a bit confusing to some users and prone to the occasional bug. Hopefully, most of the time people won't notice having to do the 'declare' once they switch, as generally the idea is that the .d.ts files are downloaded and shared, or auto-generated by the compiler.