Unlike JavaScript's const as const
variable declarations, TypeScript allows you to create fully immutable types. In this lesson, we learn how to create immutable types in TypeScript with the help of
const user = {
name: 'xxx',
education: {
degree: 'MSc'
}
} as const
const users = [
'a',
'b'
] as const
user.education.degree = "BSc"
users.push('c')
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLwUTM4YzN4ITMx0CM5UzM1QjMwAjNyIDMwIDMy0SM0IDN2MzLcJDMwIDMy8CXxQjM0YzMvwlbv1WbvN2Lc12bj5ycn9Gbi52YugTMwIzZtl2Lc9CX6MHc0RHaiojIsJye.png)