Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we infer the type of expando properties #80

Open
phillipskevin opened this issue Jun 5, 2019 · 0 comments
Open

Should we infer the type of expando properties #80

phillipskevin opened this issue Jun 5, 2019 · 0 comments
Labels
discussion Open ended discussion about the library and its design

Comments

@phillipskevin
Copy link
Contributor

Currently, this throws:

class Obj extends DefineObject {
  static get define() {
    return {
      age: 5
    };
  }
}

const obj = new Obj();
obj.age = "10"; // Uncaught Error: Type value '10' is not of type Number.

...but this doesn't:

class Obj extends DefineObject {
  static get define() {}
}

const obj = new Obj();
obj.age = 5;
obj.age = "10";

I think we should infer the type of expando properties the first time they're set.

@phillipskevin phillipskevin added the discussion Open ended discussion about the library and its design label Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Open ended discussion about the library and its design
Projects
None yet
Development

No branches or pull requests

1 participant