Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error TS1046: 'declare' modifier required for top level element

Tags:

typescript

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.

like image 938
Drew Noakes Avatar asked Jul 13 '13 23:07

Drew Noakes


1 Answers

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:

enter image description here

Source: Microsoft Blog

like image 94
basarat Avatar answered Sep 23 '22 20:09

basarat