Skip to content

Can't make @observable parameter properties #1273

Description

@JoshuaKGoldberg

I have an:

  1. Issue:
  • Provide error messages including stacktrace
  • Provide a minimal sample reproduction.
  • Did you check this issue wasn't filed before?
  • Elaborate on your issue. What behavior did you expect?
  • State the versions of MobX and relevant libraries. Which browser / node / ... version?

MobX version: 3.3.1
TypeScript version: 2.7.0-dev.20171126

import { observable } from "mobx";

type Model = { };

export class ViewModel {
    public constructor(
        // Argument of type 'number' is not assignable to parameter of type 'PropertyDescriptor | undefined'.
        @observable
        public readonly model: Model,
    ) { }
}

On the other hand, works:

export class ViewModel {
    @observable
    public readonly model: Model;

    public constructor(model: Model) {
        this.model = model;
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions