ken ken - 4 months ago 18
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

interfaces.ts
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:

interface

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

fileStatus references

But I've also just noticed that the
name
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

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.

Comments