When attempting to construct an interface in TypeScript, I discovered that the word "type" is both a keyword and a reserved term. In Visual Studio 2013 with TypeScript 1.4, for instance, when defining the following interface:
interface IExampleInterface {
type: string;
}
the term "type" appears in blue. If you then proceed to implement this interface in a class:
class ExampleClass implements IExampleInterface {
public type: string;
constructor() {
this.type = "Example";
}
}
Upon typing "type" to fulfill the required property, IntelliSense treats it as a keyword like "typeof" or "new". Searching further, I came across this GitHub issue which categorizes "type" as a "strict mode reserved word" in TypeScript. However, its exact purpose remains unclear.
I may be missing something obvious, but what exactly does the "type" reserved word signify in TypeScript?