xgqfrms / ts

TypeScript 是一个可以编译成简洁JavaScript的JavaScript超集!
MIT License
1 stars 0 forks source link

vscode online #9

Open xgqfrms opened 4 years ago

xgqfrms commented 4 years ago

vscode online


interface IProps {
    firstName: string,
    lastName: string,
    age?: number;
    gender?: string,
}

// 泛型
class Human<T> {
    constructor(props) {
        // props
    }
}

// 类型“Human”不是泛型类型
class Person extends Human<IProps> {
    // [x: string]: any;
    firstName: any;
    lastName: any;
    constructor(props) {
        super(props);
        const {
            firstName,
            lastName,
        } = props;
        this.firstName = firstName;
        this.lastName = lastName;
    }
}
xgqfrms commented 4 years ago

vscode online

https://www.cnblogs.com/xgqfrms/p/12899508.html

https://online.visualstudio.com/environment/5fbe727c-65e7-4401-8a37-50ecb2bc8d6f