Issue
I want to declare a type like this:
interface DependData {[key: string]: string};
but with error like this:
Statements are not allowed in ambient contexts
Solution
The error message you are describing occurs in a declaration file.
To make this work, you need remove the semi-colon at the end of your interface declaration:
interface DependData {
[key: string]: string;
}
The extra semi-colon is causing an empty statement to be parsed in addition to the interface declaration, thus giving that error message.
Answered By - David Sherret
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.