Search This Blog

2023/09/10

Interface & Enum with same name get merged

 interface User {

id: string
}

interface User {
name: string
}

var user: User = {
id: '1',
name: "sangram"
}

Here User interface defined twice.It get merged.

ALSO enum with same name get merged

enum Shape {
Line = 0,
}
enum Shape {
Dot = 0, // permitted
}

var sh:Shape = Shape.Dot

No comments:

Post a Comment