首页 > 解决方案 > 参数名称提示不适用于打字稿静态方法

问题描述

我在用 在此处输入图像描述

我有这Car节课

export default class Car {
    static totalCars = 0;

    constructor(public name: string, public model: number) {
        Car.totalCars++
    }

    static getReport = (template: string, lastCar : Car): string => {
        return `${template} : ${Car.totalCars}, Last car created : ${lastCar.name}, ${lastCar.model}`;
    }
}

当我尝试使用课程时

import Car from "./Car";

const bmw: Car = new Car("BMW", 2018);
const audi: Car = new Car("Audi", 2017);

console.log(Car.getReport('Total cars created: ', audi));

我没有得到静态方法 getReport的参数提示。(它适用于构造函数和成员方法)

证明

在此处输入图像描述

标签: typescriptintellij-ideawebstorm

解决方案


请尝试2​​018.2 EAP,我无法在那里重现该问题。并且不要忘记在Settings > Editor > General > Appearance > Show parameter name hints > Configure.


推荐阅读