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

Improve error for using DefineMap with a lower-cased type in definition #205

Closed
ilyavf opened this issue May 24, 2017 · 0 comments · Fixed by #257
Closed

Improve error for using DefineMap with a lower-cased type in definition #205

ilyavf opened this issue May 24, 2017 · 0 comments · Fixed by #257
Assignees

Comments

@ilyavf
Copy link

ilyavf commented May 24, 2017

Recently ran into a misused map definition: DefineMap constructor as lower-cased type along with instance of the DefineMap as value, which resulted into an unhelpful error. Lost a lot of time to figure out the misusing:

const Currency = DefineMap.extend({});
const VM = DefineMap.extend({
    currency: {
        type: Currency,                   <<< should be `Type: Currency`
        value: new Currency({})
    }
}) 

The error showing was:

 TypeError: Cannot read property 'definitions' of undefined
    at Function.define.setup (http://localhost:8080/node_modules/can-define/can-define.js:697:32)

which makes sense since it does relate to types.

Expected: a message like: In your define map you should use Type on a property that is an instance of a DefineMap.

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

Successfully merging a pull request may close this issue.

2 participants