I want to be able to have a class, `ChildError`, that has some basic definitions of its attributes per default : `code` and `message`.

However, when I will actually throw this error, it is possible that I redefine the value of `message`. If that is the case, I want to use that new definition, not the one defined by `ChildError`. 

Here is an example:

```
class BaseError extends Error {

    public code: number = 0;

    constructor(arg: any = {}) {
        super(typeof arg === 'string' ? arg : arg.message);

        this.message = arg.message;
        this.code = arg.code; 
    }

    getMessage = (): string => {
        return this.message;
    }
}

class ChildError extends BaseError {
    code = 2;
    message = 'This is the child error message';
}

const cError = new ChildError({ message: 'hello' });
console.log('print : ', cError.getMessage());

```

It prints `This is the child error message`
However, I want `hello` to be printed

Here is a [Playground link](https://www.typescriptlang.org/play/#src=class%20BaseError%20extends%20Error%20%7B%0D%0A%0D%0A%20%20%20%20constructor(arg%3A%20any%20%3D%20%7B%7D)%20%7B%0D%0A%20%20%20%20%20%20%20%20super(typeof%20arg%20%3D%3D%3D%20'string'%20%3F%20arg%20%3A%20arg.message)%3B%0D%0A%0D%0A%20%20%20%20%20%20%20%20this.message%20%3D%20arg.message%3B%0D%0A%20%20%20%20%7D%0D%0A%0D%0A%20%20%20%20getMessage%20%3D%20()%3A%20string%20%3D%3E%20%7B%0D%0A%20%20%20%20%20%20%20%20return%20this.message%3B%0D%0A%20%20%20%20%7D%0D%0A%7D%0D%0A%0D%0Aclass%20ChildError%20extends%20BaseError%20%7B%0D%0A%20%20code%20%3D%202%3B%0D%0A%20%20message%20%3D%20'This%20is%20the%20child%20error%20message'%3B%0D%0A%7D%0D%0A%0D%0Aconst%20cError%20%3D%20new%20ChildError(%7B%20message%3A%20'hello'%20%7D)%3B%0D%0Aconsole.log('print%20%3A%20'%2C%20cError.getMessage())%3B)

In the transpiled javascript, it looks like this doesn't work because the arguments passed are dealt with before we assign the default values of `code` and `message`, so they get overwritten. How to avoid that? I'd want the arguments to be dealt with after the default values! 

Also, a `console.log` in the constructor will print `this.message` as `hello` like we want to, it's when we try to access it with `getMessage()` that it returns `This is the child error message`. 

I have read this [SO thread](https://stackoverflow.com/questions/27696982/typescript-overriding-extended-property-within-constructor), but it doesn't seem to apply since the property is not the same as the class name for me...