Typescript generics

is the following code generic?

export default interface IField<I = object, O = I> {
    set(value: I): void;
    get(): O;
}

Why is it written I = object ?

Mar.29,2022

default type, if there is an I type defined, that type is I, if there is no definition, the type is object.


interface Card {
    name: string
    age: number
}

interface IField<I = Card, O = I> {
    set(value: I): void;
    get(): O;
}

// I,OI
const map: IField<string, number> = {
    set(value: string) { },
    get: () => 1,
}


// extends ,


interface List<I extends Card, O extends I> {
    set(value: I): void;
    get(): O;
}

//  I Card
// const myList: List<Date, Date> = {     
const myList: List<Card, Card> = {
    set(value: Card) { },
    get: () => {
        return {
            name: 'xiaoming',
            age: 15
        }
    },
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9bcc6-1883.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9bcc6-1883.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?