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

Prevent defining with a string #2

Closed
matthewp opened this issue May 9, 2019 · 5 comments
Closed

Prevent defining with a string #2

matthewp opened this issue May 9, 2019 · 5 comments
Labels
important Things that are important to complete

Comments

@matthewp
Copy link
Contributor

matthewp commented May 9, 2019

This will not be supported at first:

class Thing extends DefineClass {
  static define = {
    age: "number"
  }
}

We should not allow:

  • Strings
  • Functions
  • Integers
@phillipskevin
Copy link
Contributor

We do want to support constructors, right? At least for built-ins like String.

@matthewp
Copy link
Contributor Author

matthewp commented May 9, 2019

Yeah maybe. I know we want something like:

class Person extends DefineClass {
  static define = {
    name: types(String)
  }
}

Accepting constructors (functions) would prevent us from having a different meaning of passing a function in the future though.

@matthewp
Copy link
Contributor Author

Will do this after #3

@matthewp
Copy link
Contributor Author

Will it be confusing if we support:

class Person extends DefineClass {
  static define = {
    name: String
  }
}

But not:

class Thing extends DefineClass {
  static define = {
    prop: MyCustomClass
  }
}

? To me that is slightly confusing

@matthewp matthewp added the important Things that are important to complete label May 16, 2019
@matthewp
Copy link
Contributor Author

This is done in #50. Strings are now default values like other primitives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
important Things that are important to complete
Projects
None yet
Development

No branches or pull requests

2 participants