JSDoc define @type without having to initialize a new variable

Viewed 94

It's possible to define @type without having to initialize a new variable? On the following example "hi" is correctly recognized as string

new Vue({
    el: '#my-vue-id',
    data: {
        model: 'hi'
    },
    computed: {
        hiCustom: function () {
            /** @type {string} */
            var hi = model;
            return customFunction(hi);
        }
    }
})

Is it possible to directly @type model without initializing a new variable? Something like

new Vue({
    el: '#my-vue-id',
    data: {
        model: "hi"
    },
    computed: {
        hiCustom: function () {
            /** @type {string} model */
            return customFunction(model);
        }
    }
})

Perhaps it may seem useless to define the @type to model, but obviously this is just a simplified example.

0 Answers
Related