mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-26 18:44:57 +02:00
fix(typescript): fix template lineral type definition (#4474)
This commit is contained in:
@@ -5,7 +5,7 @@ Template literal types in TypeScript are a way to manipulate string values as ty
|
|||||||
For example, the following is a template literal type that concatenates two strings:
|
For example, the following is a template literal type that concatenates two strings:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
type Name = `Mr. ` + string;
|
type Name = `Mr. ${string}`;
|
||||||
|
|
||||||
let name: Name = `Mr. Smith`; // ok
|
let name: Name = `Mr. Smith`; // ok
|
||||||
let name: Name = `Mrs. Smith`; // error
|
let name: Name = `Mrs. Smith`; // error
|
||||||
|
Reference in New Issue
Block a user