Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

dojo/widget-core typo in code snippet #957

Open
agubler opened this issue Jul 4, 2018 · 0 comments
Open

dojo/widget-core typo in code snippet #957

agubler opened this issue Jul 4, 2018 · 0 comments

Comments

@agubler
Copy link
Member

agubler commented Jul 4, 2018

@sombrerox commented on Thu May 24 2018

There is a minor typo in one of the code snippets in dojo/widget-core/documentation, there is a following code snippet there:

`interface ListProperties {
items: {
id: string;
content: string;
highlighted: boolean;
};
}

class List extends WidgetBase {
protected render() {
const { items } = this.properties;

    return v('ul', { classes: 'list' }, items.map((item) => {
        const { id, highlighted, content } = item;
        const classes = [ highlighted ? 'highlighted' : null ];

        return v('li', { key: id, classes }, [ content ]);
    });
}

}`

map() is being used on an object, I believe author wanted to define items property as an array of

{
id: string;
content: string;
highlighted: boolean;
}

like:

{
id: string;
content: string;
highlighted: boolean;
}[]

rather than a single instance.

This is my first time posting so forgive me for bad formatting, I'm having some problems with code tag.
I have seen more minor mistakes in code elsewhere in documentation, I'll make sure to post back when/if I stumble upon them.

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

No branches or pull requests

1 participant