How to extend TypeScript definitions or what is causing "duplicate identifier"

1k views Asked by At

I've found a few posts about TypeScript "duplicate identifier" errors; however, I'm still confused about the root of this problem.

I have a class in a module, which extends "spine.AssetManager" and my tsconfig.json file references the spine.d.ts file in the "files" section. This allows my editor and tsc to understand the spine interface; however, it isn't clear to me why I can't have a class of the same name, but different scope defined. In my app.ts, I have code like the following, which causes no transpiler errors:

renderer: spine.webgl.SceneRenderer;

However, in my asset-manager.ts, the following causes the duplicate identifier error:

export class AssetManager extends spine.AssetManager {...}

How do I set things up so that I can use the "spine" definitions, including it's spine.AssetManager, but also extend it, and use my own "AssetManager"? (I know I could just make mine unique, "MyAssetManager", but I'm hoping there is another solution.)

0

There are 0 answers