pixijs / pixi-projection

MIT License
191 stars 34 forks source link

don't declare PointLike has mandatory z field #21

Open zh99998 opened 6 years ago

zh99998 commented 6 years ago
// pixi-projection.d.ts
declare namespace PIXI {
    interface PointLike {
        z: number;
        set(x?: number, y?: number, z?: number): void;
    }
    interface Point {
        z: number;
        set(x?: number, y?: number, z?: number): void;
    }
    interface ObservablePoint {
        _z: number;
        z: number;
        set(x?: number, y?: number, z?: number): void;
    }
}

there is mandatory z field declared in PointLike, Point and ObservablePoint. It causes compatibility problem. I can't assign other point-like object (like Vector2) into PointLike now.

if z field is optional, it should be set as optional. if not, I think it should declare another interface like ProjectionPointLike and use them in projection-ed classes

ivanpopelyshev commented 6 years ago

agree, i'll add "?" there.