String is not string

typescript

Solution

`String` is a Javascript type while `string` is a Typescript type. I don't think it's a bug so much as a quirk. Mainly because there's absolutely no reason to use the `String()` constructor over string literals.

See here: Typescript: difference between String and string

Problem

Thinking of string as String works. However thinking of String as string is broken: ``` var str1:String = "asdf"; var str2:String = new String("asdf"); var str3:string = "asdf"; var str4:string = new String("asdf"); // Error ``` Try It Also: ``` var interfaceBased:String = "123"; var keywordBased:string ="123"; interfaceBased=keywordBased; keywordBased=interfaceBased; // Error ``` Try It Is this a known compiler bug?

Original source

Related problems