ken ken - 1 year ago 178
TypeScript Question

Duplicate identifier in typescript interface

I have a small typescript app which is composed of 4-5 typescript files. One of these files is called

and I use this to define internal data structures I'm using.

In many cases, the attributes in these interfaces are giving errors that they have "duplicate identifiers" which I'm sure isn't literally true as this is my own code and I have double checked that I didn't accidentally reproduce this. Also, it appears that those properties which have errors have references to the property but that shouldn't matter, right? Here's an example:


And in this example, the
, and
properties have more than one reference to them. See below for

fileStatus references

But I've also just noticed that the
property (which is without error) also has multiple references (so the reference theory may be a red herring):

name references

Any help on explaining this would make me feel a lot saner.

p.s. error or not the syntactic sugar and the transpilation to JS works without any issues

Answer Source

references to the property but that shouldn't matter, right

Indeed references don't matter. However you should actually trigger a goto definition to see all the places where it is defined.

WARNING: might be a vscode bug especially if your project has multiple tsconfig.json files.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download