plantain-00 / type-coverage

A CLI tool to check type coverage for typescript code
MIT License
1.25k stars 44 forks source link

Differing errors reported between the plugin and the CLI #12

Open bobsilverberg opened 5 years ago

bobsilverberg commented 5 years ago

The plugin is reporting errors in VSCode, but when I run the CLI command the same errors do not appear. The errors seem invalid to me, but I cannot figure out why they're being reported in VSCode and not via the CLI. It seems to have to do with this.props not being recongnized as being typed by Props. Here's a small example:

import * as React from 'react';

type Props = {
  className: string;
};

class DiffView extends React.Component<Props> {
  render = () => {
    const { className } = this.props;

    return <p className={className} />;
  };
}

export default DiffView;

And here's what it looks like in VSCode:

screenshot 2019-01-28 09 29 21

And the "problems" pane in VSCode:

screenshot 2019-01-28 09 30 20

Note that if I change line 9 to read const { className } = this.props as Props; then most of the problems reported go away, but it still complains that "The type of 'props' is 'any'" at 9,32. According to the CLI, I don't need to add that as Props at all, so I am mostly confused about why the plugin is reporting problems that the CLI is not.

plantain-00 commented 5 years ago

This is a known issue of the vscode-type-coverage plugin: https://github.com/plantain-00/vscode-type-coverage/issues/1

When I debug the plugin in vscode, the result is same as the CLI, but when publish the plugin, the plugin report more errors than the CLI.

I still have no idea how to fix the plugin.

plantain-00 commented 4 years ago

v2.0.0 should fix this.