Reputation: 3142
I have following code which takes both string and text as datatype; but I am confused as to what exactly differs them?
export class Owner {
CompanyName: string;
Description: Text;
}
I am using Visual Studio 2015 Community Edition Update 3 and Typescript 1.8+.
Upvotes: 3
Views: 2231
Reputation: 8523
The types are not something specific to Angular 2 - it's TypeScript. That code would compile without the Angular 2 dependency.
To answer your question, there is no Text
basic type in TypeScript. You can see them all here. Text
would then likely be an interface or class, which can be used as types.
string
on the other hand, refers to the string primitive type in JavaScript (and TypeScript).
To further elaborate, Text
is an interface describing the capabilities of an HTMLElement (or TextNode) without markup content. Like you mention in your comment, it is include in lib.d.ts
, which is described here as
A special declaration file (that) ships with every installation of TypeScript. This file contains the ambient declarations for various common JavaScript constructs present in JavaScript runtimes and the DOM.
Upvotes: 6