Vue-class-component: The class method 'render' must be marked either 'private', 'public', or 'protected'

Created on 16 Jan 2019  路  3Comments  路  Source: vuejs/vue-class-component

In a fresh new project created with Vue cli 3.3.0;

App.tsx

import Vue, { CreateElement } from 'vue';
import { Component } from 'vue-property-decorator';

@Component
export default class App extends Vue {
    get isSideNavHidden(): boolean {
        return false;
    }

    render(h: CreateElement) {
        const sideNav = this.isSideNavHidden ? '' : (
            <div id='nav'>
                <router-link to='/'>Client list</router-link>
            </div>
        );

        return (
            <div id='app'>
                {sideNav}
                <router-view />
            </div>
        );
    }
}

I'm getting the warning: The class method 'render' must be marked either 'private', 'public', or 'protected'.

Adding a "public" in front of the method resolves the issue, but I though public was implicit with typescript, like in the tsx file in the "exemple" project.

Most helpful comment

add "member-access": [true, "no-public"] or "member-access": false in rules of your tslint.json

All 3 comments

This is likely caused by your linter. Please check your linter config.
https://palantir.github.io/tslint/rules/member-access/

@ktsn - True, this is caused by the linter, but is there any guidance for linter settings for Vue projects written in the style(s) of the default App template?

add "member-access": [true, "no-public"] or "member-access": false in rules of your tslint.json

Was this page helpful?
0 / 5 - 0 ratings

Related issues

viT-1 picture viT-1  路  4Comments

backbone87 picture backbone87  路  4Comments

aleksanderzubkov picture aleksanderzubkov  路  5Comments

dmitrykurmanov picture dmitrykurmanov  路  4Comments

tonypee picture tonypee  路  6Comments