practiced intersection and literal
This commit is contained in:
@@ -56,3 +56,27 @@ function changeCMtoMM(dime : (number | string)){
|
||||
}
|
||||
}
|
||||
console.log(changeCMtoMM("20"))
|
||||
|
||||
|
||||
// intersection Type || you can combine two types in this
|
||||
|
||||
type employee = {
|
||||
name : string,
|
||||
id: number,
|
||||
}
|
||||
|
||||
type manager = {
|
||||
extraPowers: boolean
|
||||
}
|
||||
|
||||
|
||||
const CEO:(employee & manager) = {
|
||||
name: "uma",
|
||||
id: 89,
|
||||
extraPowers: true
|
||||
}
|
||||
|
||||
|
||||
// Literal Type || constant type values.
|
||||
let rice:20 = 20;
|
||||
console.log(rice, "Rice")
|
||||
Reference in New Issue
Block a user