Reputation: 311185
I'm using a .d.ts
definition file I found online for interoperating with a JavaScript library.
I'm seeing the error message:
TS1046: 'declare' modifier required for top level element
What is causing this?
I'm using TypeScript 0.9.1.
Upvotes: 18
Views: 8930
Reputation: 724
in your package.json-> devDependencies part insert "fast-deep-equal": "^3.0.0",
than it should function
Upvotes: 0
Reputation: 276085
This was a breaking change between 0.8.x vs 0.9.x. declare
is now required for all top level non-interface elements (i.e. module
, class
, var
) in a declaration .d.ts
file:
Upvotes: 22
Reputation: 311185
TypeScript 0.9 is not backwards compatible with prior versions. You must prefix the top level element (probably a module
) with the declare
keyword.
Upvotes: 2