Type predicate
readonly
function printArray(fruits: readonly string[]) {}| (Union Type)
type Direction = 'left' | 'right' | 'up' | 'down';& (Intersection type)
type Student = {
name: string;
score: number;
};
type Worker = {
empolyeeId: number;
work: () => void;
};
function internWork(person: Student & Worker) {
console.log(person.name, person.empolyeeId, person.work());
}
in
as (Type Assertion)
!
is
Last updated