Skip to content

fix(almin): Payload subclass need to define "type" property #296

Merged
azu merged 3 commits intomasterfrom
check-payload-type
Nov 18, 2017
Merged

fix(almin): Payload subclass need to define "type" property #296
azu merged 3 commits intomasterfrom
check-payload-type

Conversation

@azu
Copy link
Copy Markdown
Member

@azu azu commented Nov 18, 2017

BREAKING CHANGE: It have a breaking change in TypeScript.

Before

// OK
class P1 extends Payload{
    type = "P1"
}
// OK
class P2 extends Payload {
    type: string;
    constructor() {
        super({ type: "P2" });
    }
}
// OK
class P3 extends Payload{
    constructor() {
        super({ type: "P2" });
    }
}
// OK - It is a bug
class P4 extends Payload{
    // no type
}

After

If you have inherited Payload class, should have defined type property.

// OK
class P1 extends Payload{
    type = "P1"
}
// OK
class P2 extends Payload {
    type: string;
    constructor() {
        super({ type: "P2" });
    }
}
// NG - Need to defined `type: string`
class P3 extends Payload{
    constructor() {
        super({ type: "P2" });
    }
}
// NG: Fix a bug #295 
class P4 extends Payload{
    // no type
}

fix #295

@azu azu force-pushed the check-payload-type branch from f7ef0dd to 6fa723e Compare November 18, 2017 15:26
@azu azu merged commit 1498fc3 into master Nov 18, 2017
@azu azu deleted the check-payload-type branch November 18, 2017 15:35
@azu azu mentioned this pull request Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught (in promise) DOMException: Failed to execute 'measure' on 'Performance'

1 participant