---
title: "Discussion on \"The difference between String and string in Typescript\" | Hashnode"
description: "Discussion on \"The difference between String and string in Typescript\". TypeScript is a good advancement in the javascript ecosystem. \nToday we are going to talk about the difference between the String and string types in Typescript.\nType error: Type 'String' is not assignable to type 'string'.\n\nLet's take a look at the ..."
url: "https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The difference between String and string in Typescript](https://josiasaurel.hashnode.dev/the-difference-between-string-and-string-in-typescript?utm_source=hashnode&utm_medium=feed)

TypeScript is a good advancement in the javascript ecosystem. Today we are going to talk about the difference between the String and string types in Typescript. Type error: Type 'String' is not assignable to type 'string'. Let's take a look at the ...

Feb 9, 2021 · 2 min read · josiasaurel.hashnode.dev  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#learning](https://hashnode.com/tag/learning)
-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Josias Aurel](https://hashnode.com/@JosiasAurel)

@JosiasAurel · Yaounde, Cameroon

  
[View profile](https://hashnode.com/@JosiasAurel)

Developer

Passionate about coding, building tools and experimenting with technologies. I like to learn new things and take challenges.

## Responses 1

Markdown supported · ⌘↵ to post

[Purvi Barot](https://hashnode.com/@purvi)

[Feb 12, 2021](https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3/comment/6026063ac6d91052dafe93ec)

Here is an example that shows the differences:

```
var s1 = new String("Avoid newing things where possible");
var s2 = "A string, in TypeScript of type 'string'";
var s3: string;
```

**String** is the JavaScript String type, which you could use to create new strings. Nobody does this as in JavaScript the literals are considered better, so s2 in the example above creates a new string without the use of the new keyword and without explicitly using the String object.

**string** is the TypeScript string type, which you can use to type variables, parameters and return values.

[Josias Aurel](https://hashnode.com/@JosiasAurel)

[Feb 12, 2021](https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3/comment/6026063ac6d91052dafe93ec#reply-602612a3c6d91052dafe94ac)

Nice.
